From 34784dc7f3833b370ee122310b9fdbc725484cbc Mon Sep 17 00:00:00 2001 From: M0be <154434102+M0be@users.noreply.github.com> Date: Wed, 21 Feb 2024 19:28:22 +0100 Subject: [PATCH] docs: Add tip about python -m pytest #3816 (#3831) * Add tip about python -m pytest * docs: add sentence in case modules are not installed --------- Co-authored-by: Terri Oda --- CONTRIBUTING.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f722a2cf29..cc7cc5e378 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -171,6 +171,14 @@ We recommend that you switch to having a local install (e.g. run `pip install -- The CVE Binary Tool has a set of tests that can be run using `pytest` command. Typically you want to run `pytest` in the cve-bin-tool directory to run the short test suite and make sure tests pass. +After running `pytest`, you may get several test failures relating to `ModuleNotFound` error. If you have run `pip install -r dev-requirements.txt` or equivalent and are sure you have the required modules installed, your issue may be related to Python's module search path. You can run this command instead : + +```bash +python -m pytest +``` + +This bypasses potential issues with your system's PATH environment variable, potentially looking in the wrong directory for the dependencies. + [There is a README file in the tests directory](https://github.com/intel/cve-bin-tool/blob/main/test/README.md) which contains more info about how to run specific tests, or how to run the longer tests. We have done our best to make tests stable and ensure that they pass at all times, but occasionally tests may fail due to factors outside your control (common causes: internet connectivity, rate limiting by NVD or new vulnerability data changing our test expectations). If a test doesn't pass, you should look at it to see if any changes you made caused the failure. If you're not sure, submit your code as a pull request and mention the issue and someone will try to help you sort it out.