Skip to content

Commit

Permalink
Use constraints file in tox (#349)
Browse files Browse the repository at this point in the history
Use constraints file in tox min-requirements. Also attempt to simplify testing commands.

Closes #345

* Update release tox to use constraints and restructure for ease of split

l
---------

Co-authored-by: Adam J. Jackson <[email protected]>
  • Loading branch information
oerc0122 and ajjackson authored Dec 21, 2024
1 parent daad68b commit a00bbfa
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 60 deletions.
29 changes: 7 additions & 22 deletions build_utils/pypi_release_tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ skip_install = True

[testenv]
changedir = tests_and_analysis/test
test_command = python {toxinidir}/../tests_and_analysis/test/run_tests.py --report
requirements_dir = {toxinidir}/../tests_and_analysis
passenv =
EUPHONIC_VERSION
# The name "extras" is reserved and has its own format with newlines:
# we need a token to inject into custom commands_pre, so call it extras_str
extras_str = [test,matplotlib,phonopy-reader,brille]
inst_str =
python -m pip install euphonic{[testenv]extras_str}=={env:EUPHONIC_VERSION}
commands = python {toxinidir}/../tests_and_analysis/test/run_tests.py --report

# Test PyPI source distribution
[testenv:source-{py310,py312}]
Expand All @@ -22,30 +23,14 @@ passenv =
CC_LD
LDFLAGS
CPPFLAGS
commands_pre =
python -m pip install \
--force-reinstall \
euphonic{[testenv]extras_str}=={env:EUPHONIC_VERSION} \
--no-binary 'euphonic'
commands = {[testenv]test_command}
commands_pre = {[testenv]inst_str} --no-binary 'euphonic'

[testenv:{py310,py311,py312}]
commands_pre =
python -m pip install \
--force-reinstall \
euphonic{[testenv]extras_str}=={env:EUPHONIC_VERSION} \
--only-binary 'euphonic'
commands = {[testenv]test_command}
commands_pre = {[testenv]inst_str} --only-binary 'euphonic'

[testenv:py310-min]
platform = (linux)|(win32)
deps =
numpy==1.24
-r{toxinidir}/../tests_and_analysis/tox_requirements.txt
commands_pre =
python -m pip install --force-reinstall \
-r{toxinidir}/../tests_and_analysis/minimum_euphonic_requirements.txt
python -m pip install \
euphonic{[testenv]extras_str}=={env:EUPHONIC_VERSION} \
--only-binary 'euphonic'
commands = {[testenv]test_command}
setuptools==60.*
commands_pre = {[testenv]inst_str} -c {toxinidir}/../tests_and_analysis/minimum_euphonic_requirements.txt --only-binary 'euphonic'
55 changes: 17 additions & 38 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ extras =
phonopy-reader
brille
commands =
{[testenv]test_command} --cov -m multiple_extras
{[testenv]test_command} --cov -m "multiple_extras"

[testenv:py310-no-c]
install_command = {[testenv]install_command} -Csetup-args="-Dpython_only=true"
Expand All @@ -71,42 +71,21 @@ extras =
matplotlib
phonopy-reader
brille
commands = {[testenv]test_command} -m 'not c_extension'
commands = {[testenv]test_command} -m "not c_extension"

[testenv:py310-minrequirements-linux]
skip_install = True
allowlist_externals = rm
install_command =
python -m pip install --force-reinstall {opts} {packages}
platform = linux
deps =
numpy==1.24.0
-r{toxinidir}/tests_and_analysis/tox_requirements.txt
commands_pre =
python -m pip install --force-reinstall \
-r{toxinidir}/tests_and_analysis/minimum_euphonic_requirements.txt
python -m pip install --force-reinstall \
-r{toxinidir}/tests_and_analysis/tox_requirements.txt
# Force rebuild of euphonic extension to avoid Numpy clash
rm -rf {toxinidir}/build
python -m pip install '{toxinidir}[matplotlib,phonopy-reader,brille]'
commands = {[testenv]test_command}

[testenv:py310-minrequirements-mac]
skip_install = True
allowlist_externals = rm
install_command =
python -m pip install --force-reinstall {opts} {packages}
platform = darwin
[testenv:py310-minrequirements-{linux,mac}]
platform =
linux: linux
mac: darwin
set_env =
linux: PIP_CONSTRAINT={toxinidir}/tests_and_analysis/minimum_euphonic_requirements.txt
mac: PIP_CONSTRAINT={toxinidir}/tests_and_analysis/minimum_euphonic_requirements_mac.txt
deps =
numpy==1.24.0
-r{toxinidir}/tests_and_analysis/tox_requirements.txt
commands_pre =
python -m pip install --force-reinstall \
-r{toxinidir}/tests_and_analysis/minimum_euphonic_requirements_mac.txt
python -m pip install --force-reinstall \
-r{toxinidir}/tests_and_analysis/tox_requirements.txt
# Force rebuild of euphonic extension to avoid Numpy clash
rm -rf {toxinidir}/build
python -m pip install '{toxinidir}[matplotlib,phonopy-reader,brille]'
commands = {[testenv]test_command}
numpy==1.24
setuptools==60.*
extras =
{[testenv]extras}
matplotlib
phonopy-reader
brille
commands = {[testenv]test_command} -m "multiple_extras"

0 comments on commit a00bbfa

Please sign in to comment.