Skip to content

Commit ec8ccf3

Browse files
Move tests to tox (#182)
1 parent 7455e03 commit ec8ccf3

File tree

5 files changed

+88
-74
lines changed

5 files changed

+88
-74
lines changed

.ci_pip_reqs.txt

Lines changed: 0 additions & 11 deletions
This file was deleted.

.github/workflows/ci_tests.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,14 @@ jobs:
3939
- name: Install dependencies
4040
run: |
4141
python -m pip install --upgrade pip wheel
42-
pip install -r .ci_pip_reqs.txt
43-
pip install .[reports,combine,tests]
42+
pip install -r requirements-dev.txt
4443
45-
- name: Run flake8
46-
run: |
47-
python -m flake8
44+
- name: Quality tests
45+
run: tox -e quality
4846
if: matrix.platform == 'ubuntu-latest'
4947

50-
- name: Run tests
51-
run: |
52-
pytest --cov --cov-report=xml tests
48+
- name: Unit tests
49+
run: tox -e unit
5350

5451
- name: Coverage
5552
uses: codecov/codecov-action@v1

requirements-dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
tox >= 3.26.0

setup.py

Lines changed: 64 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ def read(fname):
1212
def absolute_links(txt):
1313
"""Replace relative petab github links by absolute links."""
1414

15-
raw_base = "(https://raw.githubusercontent.com/"\
16-
"petab-dev/libpetab-python/master/"
17-
embedded_base = "(https://github.com/petab-dev/libpetab-python/"\
18-
"tree/master/"
15+
raw_base = \
16+
"(https://raw.githubusercontent.com/petab-dev/libpetab-python/master/"
17+
embedded_base = \
18+
"(https://github.com/petab-dev/libpetab-python/tree/master/"
1919
# iterate over links
20-
for var in re.findall(r'\[.*?\]\((?!http).*?\)', txt):
21-
if re.match(r'.*?.(png|svg)\)', var):
20+
for var in re.findall(r"\[.*?\]\((?!http).*?\)", txt):
21+
if re.match(r".*?.(png|svg)\)", var):
2222
# link to raw file
2323
rep = var.replace("(", raw_base)
2424
else:
@@ -30,63 +30,72 @@ def absolute_links(txt):
3030

3131
# Python version check. We need >= 3.6 due to e.g. f-strings
3232
if sys.version_info < (3, 8, 0):
33-
sys.exit('PEtab requires at least Python version 3.8')
33+
sys.exit("PEtab requires at least Python version 3.8")
3434

3535
# read version from file
36-
__version__ = ''
37-
version_file = os.path.join('petab', 'version.py')
36+
__version__ = ""
37+
version_file = os.path.join("petab", "version.py")
3838
# sets __version__
3939
exec(read(version_file)) # pylint: disable=W0122 # nosec
4040

4141
ENTRY_POINTS = {
42-
'console_scripts': [
43-
'petablint = petab.petablint:main',
44-
'petab_visualize = petab.visualize.cli:_petab_visualize_main',
42+
"console_scripts": [
43+
"petablint = petab.petablint:main",
44+
"petab_visualize = petab.visualize.cli:_petab_visualize_main",
4545
]
4646
}
4747

4848
# project metadata
4949
# noinspection PyUnresolvedReferences
50-
setup(name='petab',
51-
version=__version__,
52-
description='Parameter estimation tabular data',
53-
long_description=absolute_links(read('README.md')),
54-
long_description_content_type="text/markdown",
55-
author='The PEtab developers',
56-
author_email='daniel.weindl@helmholtz-muenchen.de',
57-
url='https://github.com/PEtab-dev/libpetab-python',
58-
packages=find_packages(exclude=['doc*', 'test*']),
59-
install_requires=['numpy>=1.15.1',
60-
'pandas>=1.2.0',
61-
'matplotlib>=3.6.0',
62-
'python-libsbml>=5.17.0',
63-
'sympy',
64-
'colorama',
65-
'seaborn',
66-
'pyyaml',
67-
'jsonschema',
68-
],
69-
include_package_data=True,
70-
python_requires='>=3.8.0',
71-
entry_points=ENTRY_POINTS,
72-
extras_require={
73-
'tests': [
74-
'flake8',
75-
'pytest',
76-
'python-libcombine',
77-
'simplesbml',
78-
'scipy',
79-
],
80-
'reports': ['Jinja2'],
81-
'combine': ['python-libcombine>=0.2.6'],
82-
'doc': [
83-
'sphinx>=3.5.3, !=5.1.0',
84-
'sphinxcontrib-napoleon>=0.7',
85-
'sphinx-markdown-tables>=0.0.15',
86-
'sphinx-rtd-theme>=0.5.1',
87-
'm2r2',
88-
'myst-nb>=0.14.0',
89-
'ipython>=7.21.0',
90-
]
91-
}
92-
)
50+
setup(
51+
name="petab",
52+
version=__version__,
53+
description="Parameter estimation tabular data",
54+
long_description=absolute_links(read("README.md")),
55+
long_description_content_type="text/markdown",
56+
author="The PEtab developers",
57+
author_email="daniel.weindl@helmholtz-muenchen.de",
58+
url="https://github.com/PEtab-dev/libpetab-python",
59+
packages=find_packages(exclude=["doc*", "test*"]),
60+
install_requires=[
61+
"numpy>=1.15.1",
62+
"pandas>=1.2.0",
63+
"matplotlib>=3.6.0",
64+
"python-libsbml>=5.17.0",
65+
"sympy",
66+
"colorama",
67+
"seaborn",
68+
"pyyaml",
69+
"jsonschema",
70+
],
71+
include_package_data=True,
72+
python_requires=">=3.8.0",
73+
entry_points=ENTRY_POINTS,
74+
extras_require={
75+
"tests": [
76+
"pytest",
77+
"pytest-cov",
78+
"simplesbml",
79+
"scipy",
80+
],
81+
"quality": [
82+
"flake8>=3.8.3",
83+
],
84+
"reports": [
85+
# https://github.com/spatialaudio/nbsphinx/issues/641
86+
"Jinja2==3.0.3",
87+
],
88+
"combine": [
89+
"python-libcombine>=0.2.6",
90+
],
91+
"doc": [
92+
"sphinx>=3.5.3, !=5.1.0",
93+
"sphinxcontrib-napoleon>=0.7",
94+
"sphinx-markdown-tables>=0.0.15",
95+
"sphinx-rtd-theme>=0.5.1",
96+
"m2r2",
97+
"myst-nb>=0.14.0",
98+
"ipython>=7.21.0",
99+
],
100+
},
101+
)

tox.ini

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[tox]
2+
3+
[testenv]
4+
5+
[testenv:quality]
6+
extras = quality
7+
commands =
8+
python -m flake8 petab setup.py tests
9+
description =
10+
Quality tests
11+
12+
[testenv:unit]
13+
extras = tests,reports,combine
14+
commands =
15+
pytest --cov=petab --cov-report=xml --cov-append \
16+
tests
17+
description =
18+
Basic tests

0 commit comments

Comments
 (0)