-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Use nox * Trying to fix nox * Fix tests * Minor items in lint * More nox details * Update Contributing.md * Add release notes * Add scipy requirement to noxfile * Move flake8 to pyproject.toml (against its will) * Revert RETWORKX_TEST_PRESERVE_IMAGES * Running tox errors * Capitalization * Try to make docs work * Edit error messages for tox * Add constraints to docs install * Include extras appropriately * Add test_with_version * Switch lint to ruff * Port some changes from nox to tox * Remove file that should not be there * Incorporate recent changes into Nox * Fix Noxfile * Revert tox usage * Include Python 3.12 * Faster lint phase * Reuse install code * Restore tox.ini and add print to the end of commands --------- Co-authored-by: Matthew Treinish <[email protected]>
- Loading branch information
1 parent
3470086
commit f93e1b2
Showing
10 changed files
with
140 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import nox | ||
|
||
nox.options.reuse_existing_virtualenvs = True | ||
nox.options.stop_on_first_error = True | ||
|
||
deps = [ | ||
"setuptools-rust", | ||
"fixtures", | ||
"testtools>=2.5.0", | ||
"networkx>=2.5", | ||
"scipy>=1.7", | ||
"stestr>=4.1", | ||
] | ||
|
||
lint_deps = [ | ||
"black~=22.0", | ||
"ruff~=0.1", | ||
"setuptools-rust", | ||
] | ||
|
||
stubs_deps = [ | ||
"mypy==1.8.0", | ||
"typing-extensions", | ||
] | ||
|
||
def install_rustworkx(session): | ||
session.install(*deps) | ||
session.install(".[all]", "-c", "constraints.txt") | ||
|
||
# We define a common base such that -e test triggers a test with the current | ||
# Python version of the interpreter and -e test_with_version launches | ||
# a test with the specified version of Python. | ||
def base_test(session): | ||
install_rustworkx(session) | ||
session.chdir("tests") | ||
session.run("python", "-m", "unittest", "discover", *session.posargs) | ||
|
||
@nox.session(python=["3"]) | ||
def test(session): | ||
base_test(session) | ||
|
||
@nox.session(python=["3.8", "3.9", "3.10", "3.11", "3.12"]) | ||
def test_with_version(session): | ||
base_test(session) | ||
|
||
@nox.session(python=["3"]) | ||
def lint(session): | ||
black(session) | ||
session.install(*lint_deps) | ||
session.run("ruff", "check", "rustworkx", "retworkx", "setup.py") | ||
session.run("cargo", "fmt", "--all", "--", "--check", external=True) | ||
session.run("python", "tools/find_stray_release_notes.py") | ||
|
||
@nox.session(python=["3"]) | ||
def docs(session): | ||
install_rustworkx(session) | ||
session.install("-r", "docs/source/requirements.txt", "-c", "constraints.txt") | ||
session.run("python", "-m", "ipykernel", "install", "--user") | ||
session.run("jupyter", "kernelspec", "list") | ||
session.chdir("docs") | ||
session.run("sphinx-build", "-W", "-d", "build/.doctrees", "-b", "html", "source", "build/html", *session.posargs) | ||
|
||
@nox.session(python=["3"]) | ||
def docs_clean(session): | ||
session.chdir("docs") | ||
session.run("rm", "-rf", "build", "source/apiref", external=True) | ||
|
||
@nox.session(python=["3"]) | ||
def black(session): | ||
session.install(*[d for d in lint_deps if "black" in d]) | ||
session.run("black", "rustworkx", "tests", "retworkx", *session.posargs) | ||
|
||
@nox.session(python=["3"]) | ||
def stubs(session): | ||
install_rustworkx(session) | ||
session.install(*stubs_deps) | ||
session.chdir("tests") | ||
session.run("python", "-m", "mypy.stubtest", "--concise", "rustworkx") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
other: | ||
- | | ||
Switched automated testing environment from | ||
Tox to `Nox <https://nox.thea.codes/en/stable/>`__. This | ||
change should not impact the end-user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters