Skip to contentSkip to conversation

test/py: pytest.mark.notbuildconfigspec()

PATCH New Heinrich Schuchardt 3 participants 3 messages Apr 22, 2019 – Apr 24, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
Hello Tom,

I will introduce the patch via u-boot-efi.git.

Regards

Heinrich

---
 test/py/README.md   |  1 +
 test/py/conftest.py | 14 +++++++++-----
 2 files changed, 10 insertions(+), 5 deletions(-)
test/py/README.md +1 -0
index 4d9d2b81d1..2156661d6c 100644
@@ -310,6 +310,7 @@ instances of:
 
 - `buildconfig.get(...`
 - `@pytest.mark.buildconfigspec(...`
+- `@pytest.mark.notbuildconfigspec(...`
 
 ### Complete invocation example
 
test/py/conftest.py +9 -5
index e40cbf0ba1..00d8ef8ba9 100644
@@ -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):

--
2.20.1

#1 lore raw

PATCH 1/1 test/py: pytest.mark.notbuildconfigspec()

Quoted 9 lines · Heinrich Schuchardt

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.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190424/445d0347/attachment.sig>
#2 lore raw

PATCH 1/1 test/py: pytest.mark.notbuildconfigspec()

In reply to Heinrich Schuchardt
Quoted 7 lines · Heinrich Schuchardt

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.