summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2019-04-22 09:18:55 +0200
committerHeinrich Schuchardt <xypron.glpk@gmx.de>2019-04-23 00:37:28 +0200
commit10feb30c701d3cf264746d0d81bd566f002de24b (patch)
treedd076890fd254d0d91b093979f890d75b950d8e7 /test
parentf95b8a4b5f64fd43e88c756662e77330dce8c007 (diff)
test/py: pytest.mark.notbuildconfigspec()
We already can let a Python test depend on a build option being set via @pytest.mark.buildconfigspec(). It may be necessary to let a test depend on a build option *not* being set. So let's introduce @pytest.mark.notbuildconfigspec for this purpose. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'test')
-rw-r--r--test/py/README.md1
-rw-r--r--test/py/conftest.py14
2 files changed, 10 insertions, 5 deletions
diff --git a/test/py/README.md b/test/py/README.md
index 4d9d2b81d1..2156661d6c 100644
--- a/test/py/README.md
+++ b/test/py/README.md
@@ -310,6 +310,7 @@ instances of:
- `buildconfig.get(...`
- `@pytest.mark.buildconfigspec(...`
+- `@pytest.mark.notbuildconfigspec(...`
### Complete invocation example
diff --git a/test/py/conftest.py b/test/py/conftest.py
index e40cbf0ba1..00d8ef8ba9 100644
--- a/test/py/conftest.py
+++ b/test/py/conftest.py
@@ -460,11 +460,15 @@ def setup_buildconfigspec(item):
"""
mark = item.get_marker('buildconfigspec')
- if not mark:
- return
- for option in mark.args:
- if not ubconfig.buildconfig.get('config_' + option.lower(), None):
- pytest.skip('.config feature "%s" not enabled' % option.lower())
+ if mark:
+ for option in mark.args:
+ if not ubconfig.buildconfig.get('config_' + option.lower(), None):
+ pytest.skip('.config feature "%s" not enabled' % option.lower())
+ notmark = item.get_marker('notbuildconfigspec')
+ if notmark:
+ for option in notmark.args:
+ if ubconfig.buildconfig.get('config_' + option.lower(), None):
+ pytest.skip('.config feature "%s" enabled' % option.lower())
def tool_is_in_path(tool):
for path in os.environ["PATH"].split(os.pathsep):