diff --git a/.flake8 b/.flake8 index 84252c8..6a52551 100644 --- a/.flake8 +++ b/.flake8 @@ -1,4 +1,4 @@ [flake8] -extend-exclude = _skbuild/,siliconcompiler/ +extend-exclude = _skbuild/,siliconcompiler/,.venv/ max-line-length = 100 ignore = diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 7295db6..a5bc326 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -26,5 +26,8 @@ jobs: - name: Lint with Flake8 run: | - python -m pip install flake8 -c ./requirements.txt + python3 -m venv .venv + . .venv/bin/activate + + python3 -m pip install flake8 -c ./requirements.txt flake8 --statistics . diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1b56ede..b61e320 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -42,6 +42,14 @@ jobs: - name: Run Python tests run: | + python3 -m venv .venv + . .venv/bin/activate + python3 -m pip install --upgrade pip python3 -m pip install .[test] - pytest + + # change running directory + mkdir testrun + cd testrun + + pytest $GITHUB_WORKSPACE diff --git a/conftest.py b/conftest.py new file mode 100644 index 0000000..b84b5a8 --- /dev/null +++ b/conftest.py @@ -0,0 +1,4 @@ +collect_ignore = [ + "siliconcompiler/", + "_skbuild/" +] diff --git a/pyproject.toml b/pyproject.toml index 48eb903..26bc864 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,5 +10,10 @@ requires = [ build-backend = "setuptools.build_meta" [tool.pytest.ini_options] -testpaths = "tests" +testpaths = [ + "tests" +] timeout = "120" +addopts = [ + "--import-mode=importlib", +] diff --git a/tests/conftest.py b/tests/conftest.py index a0f170c..98ea958 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -2,13 +2,6 @@ import os -@pytest.fixture -def scroot(): - '''Returns an absolute path to the SC root directory.''' - mydir = os.path.dirname(__file__) - return os.path.abspath(os.path.join(mydir, '..', 'siliconcompiler')) - - @pytest.fixture def datadir(request): '''Returns an absolute path to the current test directory's local data