Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use constraints file in tox #349

Merged
merged 4 commits into from
Dec 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
Loading