Skip to content

Commit

Permalink
Test against the packaged version
Browse files Browse the repository at this point in the history
  • Loading branch information
Mauko Quiroga committed Oct 19, 2018
1 parent b46ae77 commit 2319b3b
Show file tree
Hide file tree
Showing 8 changed files with 79 additions and 35 deletions.
12 changes: 6 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2
jobs:
build_python2:
docker:
- image: python:2.7.14
- image: python:2.7.15

steps:
- checkout
Expand All @@ -21,14 +21,14 @@ jobs:
- run:
name: Install dependencies
command: |
pip install --upgrade pip twine wheel
make build
# pip install --editable git+https://github.com/openfisca/openfisca-core.git@BRANCH#egg=OpenFisca-Core[web-api] # use a specific branch of OpenFisca-Core
pip install --editable .[dev] --upgrade
- save_cache:
key: v1-py2-{{ checksum "setup.py" }}
paths:
- /tmp/venv/country_template
- dist

- run:
name: Run tests
Expand All @@ -42,7 +42,7 @@ jobs:
deploy_python2:
docker:
- image: python:2.7.14
- image: python:2.7.15
environment:
PYPI_USERNAME: openfisca-bot # Edit this value to replace it by your Pypi username
# PYPI_PASSWORD: this value is set in CircleCI's web interface; do not set it here, it is a secret!
Expand Down Expand Up @@ -87,14 +87,14 @@ jobs:
- run:
name: Install dependencies
command: |
pip install --upgrade pip twine wheel
make build
# pip install --editable git+https://github.com/openfisca/openfisca-core.git@BRANCH#egg=OpenFisca-Core[web-api] # use a specific branch of OpenFisca-Core
pip install --editable .[dev] --upgrade
- save_cache:
key: v1-py3-{{ checksum "setup.py" }}
paths:
- /tmp/venv/country_template
- dist

- run:
name: Run tests
Expand Down
2 changes: 1 addition & 1 deletion .circleci/has-functional-changes.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /usr/bin/env bash

IGNORE_DIFF_ON="README.md CONTRIBUTING.md .gitignore .circleci/* .github/*"
IGNORE_DIFF_ON="README.md CONTRIBUTING.md Makefile .gitignore .circleci/* .github/*"

last_tagged_commit=`git describe --tags --abbrev=0 --first-parent` # --first-parent ensures we don't follow tags not published in master through an unlikely intermediary merge commit

Expand Down
1 change: 0 additions & 1 deletion .circleci/publish-python-package.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#! /usr/bin/env bash

python setup.py bdist_wheel # build this package in the dist directory
twine upload dist/* --username $PYPI_USERNAME --password $PYPI_PASSWORD # publish
File renamed without changes.
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1 @@
recursive-include * *
recursive-include openfisca_country_template *
37 changes: 35 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,40 @@
all: test

uninstall:
pip freeze | grep -v "^-e" | xargs pip uninstall -y

clean:
rm -rf build dist
find . -name '*.pyc' -exec rm \{\} \;

test:
flake8
deps:
pip install --upgrade pip twine wheel

install: deps
@# Install OpenFisca-Extension-Template for development.
@# `make install` installs the editable version of OpenFisca-France.
@# This allows contributors to test as they code.
pip install --editable .[dev] --upgrade

build: clean deps
@# Install OpenFisca-Extension-Template for deployment and publishing.
@# `make build` allows us to be be sure tests are run against the packaged version
@# of OpenFisca-Extension-Template, the same we put in the hands of users and reusers.
python setup.py bdist_wheel
find dist -name "*.whl" -exec pip install --upgrade {}[dev] \;

check-syntax-errors:
python -m compileall -q .

format-style:
@# Do not analyse .gitignored files.
@# `make` needs `$$` to output `$`. Ref: http://stackoverflow.com/questions/2382764.
autopep8 `git ls-files | grep "\.py$$"`

check-style:
@# Do not analyse .gitignored files.
@# `make` needs `$$` to output `$`. Ref: http://stackoverflow.com/questions/2382764.
flake8 `git ls-files | grep "\.py$$"`

test: clean check-syntax-errors check-style
openfisca-run-test --country-package openfisca_country_template openfisca_country_template/tests
17 changes: 11 additions & 6 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
# This file configures flake8, a Python tool which makes sure our code follow certain standards.
; E128/133: We prefer hang-closing visual indents
; E251: We prefer `function(x = 1)` over `function(x=1)`
; E501: We do not enforce a maximum line length
; F403/405: We ignore * imports
; W503/504: We break lines before binary operators (Knuth's style)

[flake8]
hang-closing = true
; E251: We prefer `function(x = 1)` over `function(x=1)`
; E501: We do not enforce a maximum line length
; F403, F405: We allow `import *`
; W503: We break lines before binary operators
ignore = E251, E501, F403, F405, W503
ignore = E128,E251,F403,F405,E501,W503

[pep8]
hang-closing = true
ignore = E128,E251,F403,F405,E501,W503
in-place = true
43 changes: 25 additions & 18 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,37 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-


from setuptools import setup, find_packages


setup(
name='OpenFisca-Country-Template',
version='3.5.0',
author='OpenFisca Team',
author_email='contact@openfisca.fr',
description=u'OpenFisca tax and benefit system for Country-Template',
keywords='benefit microsimulation social tax',
license='http://www.fsf.org/licensing/licenses/agpl-3.0.html',
url='https://github.com/openfisca/country-template',
name = "OpenFisca-Country-Template",
version = "3.5.0",
author = "OpenFisca Team",
author_email = "contact@openfisca.org",
classifiers=[
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: GNU Affero General Public License v3",
"Operating System :: POSIX",
"Programming Language :: Python",
"Topic :: Scientific/Engineering :: Information Analysis",
],
description = "OpenFisca tax and benefit system for Country-Template",
keywords = "benefit microsimulation social tax",
license ="http://www.fsf.org/licensing/licenses/agpl-3.0.html",
url = "https://github.com/openfisca/country-template",
include_package_data = True, # Will read MANIFEST.in
install_requires=[
'OpenFisca-Core[web-api] >= 24.6, < 25.0',
data_files = [
("share/openfisca/openfisca-country-template", ["CHANGELOG.md", "LICENSE", "README.md"]),
],
install_requires = [
"OpenFisca-Core[web-api] >= 24.6, < 25.0",
],
extras_require = {
'dev': [
'flake8 >= 3.4.0, < 3.5.0',
'flake8-print',
'nose',
"dev": [
"autopep8 == 1.4.0",
"flake8 >= 3.5.0, < 3.6.0",
"flake8-print",
"pycodestyle >= 2.3.0, < 2.4.0", # To avoid incompatibility with flake
]
},
packages=find_packages(),
test_suite='nose.collector',
)

0 comments on commit 2319b3b

Please sign in to comment.