← Back to team overview

sts-sponsors team mailing list archive

[Merge] ~bjornt/maas:pytest-no-pythonseeds into maas:master

 

Björn Tillenius has proposed merging ~bjornt/maas:pytest-no-pythonseeds into maas:master.

Commit message:
Make seeds reporting work when no setup has been done.



Requested reviews:
  MAAS Maintainers (maas-maintainers)

For more details, see:
https://code.launchpad.net/~bjornt/maas/+git/maas/+merge/435358
-- 
Your team MAAS Committers is subscribed to branch maas:master.
diff --git a/src/maastesting/pytest/seeds.py b/src/maastesting/pytest/seeds.py
index dee17cf..dfd11ee 100644
--- a/src/maastesting/pytest/seeds.py
+++ b/src/maastesting/pytest/seeds.py
@@ -12,7 +12,9 @@ pythonseeds_stash = pytest.StashKey[str]()
 
 @pytest.hookimpl
 def pytest_runtest_makereport(item, call):
-    if call.excinfo is None:
+    # If no tests were run for some reason, like skips or setup erros,
+    # pythonseeds didn't get initialized.   
+    if call.excinfo is None or pythonseeds_stash not in item.config.stash:
         return
     python_hash_seed = item.config.stash[pythonseeds_stash]
     maas_rand_seed = item.config.stash[maasseeds_stash]

Follow ups