From 2781d994fb8ba7ca1bf8cacef937fea5e3bf8e99 Mon Sep 17 00:00:00 2001
From: dboe <dboe@ipp.mpg.de>
Date: Thu, 9 Dec 2021 14:53:28 +0100
Subject: [PATCH] explicit pytest path to .tox dir solves the issue

---
 .gitlab-ci.yml |  2 --
 setup.cfg      | 12 +++++++++---
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index f16c13a..a843306 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -36,8 +36,6 @@ dist:
     - python setup.py bdist_wheel
     # an alternative approach is to install and run:
     - pip install dist/*
-    # remove build directory in order to prevent ImportPathMismatchError
-    - rm -rf build
   artifacts:
     paths:
       - dist/*.whl
diff --git a/setup.cfg b/setup.cfg
index 87d7787..308d55d 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -125,21 +125,26 @@ build-dir = docs/_build
 source-dir = docs
 
 [tool:pytest]
-addopts = --doctest-modules
+addopts =
+	--doctest-modules
 junit_family = xunit2
 
 [tox:tox]
 minversion = 3.7
 skip_missing_interpreters = true
 envlist = 
-	py{38,39}
+	py{35,36,37,38,39,310}
 recreate = true
 usedevelop = true
 
 [gh-actions]
 python = 
+	3.5: py35
+	3.6: py36
+	3.7: py37
 	3.8: py38
 	3.9: py39
+	3.10: py310
 
 [testenv]
 description = run test suite under {basepython}
@@ -152,7 +157,8 @@ commands_pre =
 	rm -rf **/__pycache__
 	rm -rf **/*.pyc
 commands = 
-	pytest \
+	pytest {envsitepackagesdir}/tfields \  # prevent ImportPathMismatchError https://tox.wiki/en/latest/example/pytest.html
+	--basetemp="{envtmpdir}" {posargs}
 	--cov={[metadata]name} \
 	--ignore=docs \
 	--junitxml=report/junit.xml
-- 
GitLab