diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b754c1b..19deaad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,7 +30,7 @@ jobs: python -m pip install -r requirements.dev.txt - name: Test with pytest run: | - coverage run -m pytest -m "not benchmark" + coverage run -m pytest tests -m "not benchmark" - name: Upload Coverage to Codecov if: ${{ matrix.python-version == 3.11 && matrix.platform == 'ubuntu-latest' }} diff --git a/conftest.py b/conftest.py deleted file mode 100644 index c79442e..0000000 --- a/conftest.py +++ /dev/null @@ -1,12 +0,0 @@ -""" -Tests run from the project root folder. -But the code expects to run inside src folder. - -So for tests we add src folder to sys.path. - -This file is loaded first by py.test therefore we change sys.path for all other python files. -""" -import os.path -import sys - -sys.path.append(os.path.join(os.path.dirname(__file__), "src")) diff --git a/tests/conftest.py b/tests/conftest.py index bcf5608..c5369ab 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -9,6 +9,12 @@ sys.modules["scapy.layers.dhcp"] = Mock() sys.modules["scapy.layers.l2"] = Mock() +# Point sys.path to our sources before importing anything from them +import os.path +import sys + +sys.path.append(os.path.join(os.path.dirname(__file__), "../src")) + # We need to import amazon_dash after mocking scapy from amazon_dash import AmazonDash