diff --git a/.github/workflows/install_and_test.yml b/.github/workflows/install_and_test.yml index 982c9089d..a23887e4b 100644 --- a/.github/workflows/install_and_test.yml +++ b/.github/workflows/install_and_test.yml @@ -33,3 +33,8 @@ jobs: run: pytest - name: Run CLI run: pyspdxtools -i ./tests/spdx/data/formats/SPDXJSONExample-v2.3.spdx.json + + - name: Install optional dependencies + run: python -m pip install networkx + - name: Run tests for graph generation + run: pytest tests/spdx/test_graph_generation.py diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 653b366fa..4c4a04341 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -34,8 +34,10 @@ Here's the process to make changes to the codebase: git checkout -b fix-or-improve-something python -m venv ./venv ./venv/bin/activate - pip install -e . + pip install -e ".[development]" ``` + Note: By using the group `[development]` for the installation, all dependencies (including optional ones) will be + installed. This way we make sure that all tests are executed. 5. Make some changes and commit them to the branch: ```sh git commit --signoff -m 'description of my changes' @@ -49,14 +51,12 @@ Here's the process to make changes to the codebase: retroactively signs a range of past commits. 6. Test your changes: ```sh - pip install pytest pytest -vvs # in the repo root ``` 7. Check your code style. When opening a pull request, your changes will automatically be checked with `isort`, `black` and `flake8` to make sure your changes fit with the rest of the code style. ```sh - pip install .[code_style] # run the following commands in the repo root isort src tests black src tests diff --git a/pyproject.toml b/pyproject.toml index 338339c31..7acbb7ffa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,6 +31,7 @@ dynamic = ["version"] test = ["pytest"] code_style = ["isort", "black", "flake8"] graph_generation = ["pygraphviz", "networkx"] +development = ["black", "flake8", "isort", "networkx", "pytest"] [project.scripts] pyspdxtools = "spdx.clitools.pyspdxtools:main" diff --git a/tests/spdx/test_graph_generation.py b/tests/spdx/test_graph_generation.py index 6c28d1d41..9128625f2 100644 --- a/tests/spdx/test_graph_generation.py +++ b/tests/spdx/test_graph_generation.py @@ -15,7 +15,6 @@ try: import networkx # noqa: F401 - import pygraphviz # noqa: F401 except ImportError: pytest.skip("Skip this module as the tests need optional dependencies to run.", allow_module_level=True) @@ -44,7 +43,7 @@ ( "SPDXRdfExample-v2.2.spdx.rdf.xml", 20, - 17, + 19, ["SPDXRef-Package_DYNAMIC_LINK", "SPDXRef-JenaLib_CONTAINS"], ), (