diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c02d3180d..d218e27d7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -122,11 +122,17 @@ rust code (or packaged python code) changes to the repo since then. Otherwise the rustworkx package Nox installs in its virtualenv will be out of date (or missing). -Note, if you run tests outside of Nox that you can **not** run the tests from +> [!NOTE] +> If you run tests outside of Nox that you can **not** run the tests from the root of the repo, this is because rustworkx packaging shim will conflict with imports from rustworkx the installed version of rustworkx (which contains the compiled extension). + +> [!NOTE] +> For compatibility purposes, rustworkx tests can also be run with `tox`. +Most commands should work by just replacing `nox` with `tox`. + #### Running tests with a specific Python version If you want to run the tests with a specific version of Python, use the `test_with_version` diff --git a/pyproject.toml b/pyproject.toml index fd7977e2f..805a04805 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -151,4 +151,16 @@ environment = "MACOSX_DEPLOYMENT_TARGET=10.12" repair-wheel-command = "brew install pipx && pipx ensurepath && pipx run --spec delocate==0.11.0 delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel} && pipx run abi3audit==0.0.9 --strict --report {wheel}" [tool.cibuildwheel.windows] -repair-wheel-command = "cp {wheel} {dest_dir}/. && pipx run abi3audit==0.0.9 --strict --report {wheel}" \ No newline at end of file +repair-wheel-command = "cp {wheel} {dest_dir}/. && pipx run abi3audit==0.0.9 --strict --report {wheel}" + +[tool.tox] +legacy_tox_ini = """ + [tox] + minversion = 4.4.0 + envlist = py, lint, tests, docs, stubs, black + + [testenv] + deps = nox + commands = nox -e {envname} -- {posargs} + skip_install = true +""" \ No newline at end of file diff --git a/tox.ini b/tox.ini deleted file mode 100644 index 618baf392..000000000 --- a/tox.ini +++ /dev/null @@ -1,93 +0,0 @@ -[tox] -minversion = 4.4.0 -envlist = py39, py310, py311, lint -isolated_build = true - -[testenv] -install_command = python -I -m pip install -c{toxinidir}/constraints.txt -U {opts} {packages} -setenv = - VIRTUAL_ENV={envdir} - LANGUAGE=en_US - LC_ALL=en_US.utf-8 - ARGS="-V" - RUST_DEBUG=1 -deps = - setuptools-rust - fixtures - testtools>=2.5.0 - networkx>=2.5 - stestr>=4.1 -extras = - mpl - graphviz -passenv = - RUSTWORKX_TEST_PRESERVE_IMAGES - RUSTWORKX_PKG_NAME - RUSTWORKX_DEBUG -changedir = {toxinidir}/tests -commands = - stestr run {posargs} - python -c "print('\nrustworkx no longer supports tox. Please run the equivalent command with nox:\n\n\tnox -e test\n')" - -[testenv:lint] -basepython = python3 -skip_install = true -deps = - black~=24.8 - ruff -allowlist_externals=cargo -commands = - black --check --diff {posargs} '../rustworkx' '../tests' '../retworkx' - ruff check ../rustworkx ../retworkx . ../setup.py - cargo fmt --all -- --check - python {toxinidir}/tools/find_stray_release_notes.py - python -c "print('\nrustworkx no longer supports tox. Please run the equivalent command with nox:\n\n\tnox -e lint\n')" - - -[testenv:docs] -basepython = python3 -setenv = - {[testenv]setenv} - RUSTWORKX_DEBUG=1 -deps = - -r {toxinidir}/docs/source/requirements.txt -passenv = - {[testenv]passenv} - RUSTWORKX_DEV_DOCS - RUSTWORKX_LEGACY_DOCS - RUST_DEBUG -changedir = {toxinidir}/docs -commands = - python -m ipykernel install --user - jupyter kernelspec list - sphinx-build -W -d {toxinidir}/docs/build/.doctrees -b html source build/html {posargs} - python -c "print('\nrustworkx no longer supports tox. Please run the equivalent command with nox:\n\n\tnox -e docs\n')" - -[testenv:docs-clean] -skip_install = true -deps = -allowlist_externals = rm -commands = - rm -rf {toxinidir}/docs/build {toxinidir}/docs/source/apiref - python -c "print('\nrustworkx no longer supports tox. Please run the equivalent command with nox:\n\n\tnox -e docs_clean\n')" - -[testenv:black] -basepython = python3 -skip_install = true -deps = - black~=24.8 -commands = - black {posargs} '../rustworkx' '../tests' '../retworkx' - python -c "print('\nrustworkx no longer supports tox. Please run the equivalent command with nox:\n\tnox -e black\n')" - -[testenv:stubs] -basepython = python3 -deps = - mypy==1.8.0 - typing-extensions -extras = - mpl - graphviz -commands = - python -m mypy.stubtest --concise rustworkx - python -c "print('\nrustworkx no longer supports tox. Please run the equivalent command with nox:\n\n\tnox -e stubs\n')"