Skip to content
This repository was archived by the owner on Nov 14, 2022. It is now read-only.

Commit 2b47494

Browse files
authored
Switch to tox (AR-1667) (#1481)
* Try testing tox * Try again * Skip packaging operation * And again * Add pytest-django * Add in parameterized as a dependency * Move pytest options to pyproject.toml * Specify explicit path {envsitepackagesdir}/mypkg to pytest. To fix pytest importing from checkout and not installed * Move extras to the correct config * Update tox.ini * Fix rogue reference to wrong test folder * Add code inspection tests * Create all-in-one code inspection * Remove repeated data * Remove unused command * Update cov folder * Remove extras sections as I believe it is inherited from base [testenv] * Keep build actions as is * Fix typo and pin setuptools
1 parent 4dae542 commit 2b47494

File tree

5 files changed

+339
-56
lines changed

5 files changed

+339
-56
lines changed

.github/workflows/run-tests.yml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,11 @@ jobs:
3434
with:
3535
repository: "autoreduction/autoreduce-workspace"
3636

37-
- name: Run system tests
38-
run: |
39-
RUNNING_VIA_PYTEST=true pytest autoreduce_qp/systemtests --cov-append -v
37+
- name: Install Tox
38+
run: python -m pip install tox tox-gh-actions
4039

41-
- name: Run unit tests
42-
run: >-
43-
RUNNING_VIA_PYTEST=true pytest --ignore=autoreduce_qp/systemtests --cov=autoreduce_qp --cov-report=xml -v autoreduce_qp
40+
- name: Test with tox
41+
run: tox -e pytest
4442

4543
- uses: codecov/codecov-action@v3
4644
with:
@@ -86,8 +84,7 @@ jobs:
8684
- name: Pip install
8785
run: |
8886
pip install --upgrade pip
89-
[ -f "requirements.txt" ] && pip install -r requirements.txt || echo "No requirements.txt found"
90-
pip install -e .
87+
pip install -e .[dev]
9188
9289
Inspection:
9390
name: Code Inspection
@@ -116,6 +113,8 @@ jobs:
116113
with:
117114
package_name: autoreduce_qp
118115

119-
- uses: autoreduction/autoreduce-actions/code_inspection@main
120-
with:
121-
package_name: autoreduce_qp
116+
- name: Install Tox
117+
run: python -m pip install tox tox-gh-actions
118+
119+
- name: Run code inspection with tox
120+
run: tox -e code_inspection

.gitignore

Lines changed: 237 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,256 @@
1-
# Ignore IDE files
2-
.idea/*
3-
*/target/**
4-
.pytest_cache/
5-
1+
# Created by https://www.toptal.com/developers/gitignore/api/python,django
2+
# Edit at https://www.toptal.com/developers/gitignore?templates=python,django
63

7-
# Ignore complied python
4+
### Django ###
5+
*.log
6+
*.pot
87
*.pyc
8+
__pycache__/
9+
local_settings.py
10+
db.sqlite3
11+
db.sqlite3-journal
12+
media
913

10-
# Ignore log data
11-
*.log
12-
logs/
14+
# If your build process includes running collectstatic, then you probably don't need or want to include staticfiles/
15+
# in your Git repository. Update and uncomment the following line accordingly.
16+
# <django-project-name>/staticfiles/
1317

14-
# *.out
18+
### Django.Python Stack ###
19+
# Byte-compiled / optimized / DLL files
20+
*.py[cod]
21+
*$py.class
1522

16-
# Ignore credentials files
17-
credentials.ini
23+
# C extensions
24+
*.so
1825

19-
# Ignore distutils installation
26+
# Distribution / packaging
27+
.Python
28+
build/
29+
develop-eggs/
2030
dist/
31+
downloads/
32+
eggs/
33+
.eggs/
34+
lib/
35+
lib64/
36+
parts/
37+
sdist/
38+
var/
39+
wheels/
40+
share/python-wheels/
41+
*.egg-info/
42+
.installed.cfg
43+
*.egg
44+
MANIFEST
45+
46+
# PyInstaller
47+
# Usually these files are written by a python script from a template
48+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
49+
*.manifest
50+
*.spec
51+
52+
# Installer logs
53+
pip-log.txt
54+
pip-delete-this-directory.txt
55+
56+
# Unit test / coverage reports
57+
htmlcov/
58+
.tox/
59+
.nox/
60+
.coverage
61+
.coverage.*
62+
.cache
63+
nosetests.xml
64+
coverage.xml
65+
*.cover
66+
*.py,cover
67+
.hypothesis/
68+
.pytest_cache/
69+
cover/
70+
71+
# Translations
72+
*.mo
73+
74+
# Django stuff:
75+
76+
# Flask stuff:
77+
instance/
78+
.webassets-cache
79+
80+
# Scrapy stuff:
81+
.scrapy
82+
83+
# Sphinx documentation
84+
docs/_build/
2185

22-
# Ignore virtual environment
86+
# PyBuilder
87+
.pybuilder/
88+
target/
89+
90+
# Jupyter Notebook
91+
.ipynb_checkpoints
92+
93+
# IPython
94+
profile_default/
95+
ipython_config.py
96+
97+
# pyenv
98+
# For a library or package, you might want to ignore these files since the code is
99+
# intended to run in multiple environments; otherwise, check them in:
100+
# .python-version
101+
102+
# pipenv
103+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
104+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
105+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
106+
# install all needed dependencies.
107+
#Pipfile.lock
108+
109+
# poetry
110+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
111+
# This is especially recommended for binary packages to ensure reproducibility, and is more
112+
# commonly ignored for libraries.
113+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
114+
#poetry.lock
115+
116+
# pdm
117+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
118+
#pdm.lock
119+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
120+
# in version control.
121+
# https://pdm.fming.dev/#use-with-ide
122+
.pdm.toml
123+
124+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
125+
__pypackages__/
126+
127+
# Celery stuff
128+
celerybeat-schedule
129+
celerybeat.pid
130+
131+
# SageMath parsed files
132+
*.sage.py
133+
134+
# Environments
135+
.env
136+
.venv
137+
env/
23138
venv/
24-
venv3/
25-
venv36/
26-
venv37/
139+
ENV/
140+
env.bak/
141+
venv.bak/
27142

28-
# Ignore pip install installation
29-
autoreduce_qp.egg-info/
143+
# Spyder project settings
144+
.spyderproject
145+
.spyproject
30146

31-
# This is generated from a template so should be ignored to force regeneration
32-
apache_django_wsgi.conf
147+
# Rope project settings
148+
.ropeproject
33149

34-
# Ignore coverage logs
35-
.coverage
150+
# mkdocs documentation
151+
/site
36152

37-
# Include the coverage configuration file
38-
!.coveragerc
153+
# mypy
154+
.mypy_cache/
155+
.dmypy.json
156+
dmypy.json
39157

40-
# Ignore site.retry from Ansible
41-
site.retry
42-
vault.yml
158+
# Pyre type checker
159+
.pyre/
43160

44-
.DS_Store
161+
# pytype static type analyzer
162+
.pytype/
45163

46-
# Ignore developer specific .vscode/settings.json
47-
.vscode/settings.json
164+
# Cython debug symbols
165+
cython_debug/
48166

49-
# ignore sqlite3 db files
50-
**/sqlite3*.db*
167+
# PyCharm
168+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
169+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
170+
# and can be added to the global gitignore or merged into this file. For a more nuclear
171+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
172+
#.idea/
51173

52-
# folders that get created from tests
53-
reduced-data/
54-
data-archive/
55-
test-archive/
174+
### Python ###
175+
# Byte-compiled / optimized / DLL files
56176

57-
# pip build files
58-
build/
59-
dist/
177+
# C extensions
178+
179+
# Distribution / packaging
180+
181+
# PyInstaller
182+
# Usually these files are written by a python script from a template
183+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
184+
185+
# Installer logs
186+
187+
# Unit test / coverage reports
188+
189+
# Translations
190+
191+
# Django stuff:
192+
193+
# Flask stuff:
194+
195+
# Scrapy stuff:
196+
197+
# Sphinx documentation
198+
199+
# PyBuilder
200+
201+
# Jupyter Notebook
202+
203+
# IPython
204+
205+
# pyenv
206+
# For a library or package, you might want to ignore these files since the code is
207+
# intended to run in multiple environments; otherwise, check them in:
208+
# .python-version
209+
210+
# pipenv
211+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
212+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
213+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
214+
# install all needed dependencies.
215+
216+
# poetry
217+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
218+
# This is especially recommended for binary packages to ensure reproducibility, and is more
219+
# commonly ignored for libraries.
220+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
221+
222+
# pdm
223+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
224+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
225+
# in version control.
226+
# https://pdm.fming.dev/#use-with-ide
227+
228+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
229+
230+
# Celery stuff
231+
232+
# SageMath parsed files
233+
234+
# Environments
235+
236+
# Spyder project settings
237+
238+
# Rope project settings
239+
240+
# mkdocs documentation
241+
242+
# mypy
243+
244+
# Pyre type checker
245+
246+
# pytype static type analyzer
247+
248+
# Cython debug symbols
249+
250+
# PyCharm
251+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
252+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
253+
# and can be added to the global gitignore or merged into this file. For a more nuclear
254+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
255+
256+
# End of https://www.toptal.com/developers/gitignore/api/python,django

autoreduce_qp/pytest.ini

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

pyproject.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ dependencies = [
2121
]
2222

2323
[project.optional-dependencies]
24-
dev = []
24+
dev = ["parameterized==0.8.1", "pytest==7.1.2"]
2525

2626
[project.urls]
2727
"Repository" = "https://github.com/autoreduction/queue-processor"
@@ -34,6 +34,11 @@ autoreduce-runner-start = "autoreduce_qp.queue_processor.reduction.runner:main"
3434
[tool.setuptools]
3535
packages = ["autoreduce_qp"]
3636

37+
[tool.pytest.ini_options]
38+
DJANGO_SETTINGS_MODULE = "autoreduce_django.settings"
39+
norecursedirs = [".*", "dist", "CVS", "_darcs", "{arch}", "*.egg"]
40+
python_files = ["tests.py", "test_*.py", "*_tests.py"]
41+
3742
[tool.yapf]
3843
column_limit = 120
3944
based_on_style = "pep8"

0 commit comments

Comments
 (0)