Lunderberg commented on a change in pull request #8343:
URL: https://github.com/apache/tvm/pull/8343#discussion_r660838294
##########
File path: tests/python/unittest/test_tvm_testing_features.py
##########
@@ -145,5 +145,37 @@ def test_cached_count(self):
assert self.cached_calls == len(self.param1_vals)
+class TestBrokenFixture:
+ # Tests that use a fixture that throws an exception fail, and are
+ # marked as setup failures. The tests themselves are never run.
+ # This behavior should be the same whether or not the fixture
+ # results are cached.
+
+ num_uses_broken_uncached_fixture = 0
+ num_uses_broken_cached_fixture = 0
+
+ @tvm.testing.fixture
+ def broken_uncached_fixture(self):
+ raise RuntimeError("Intentionally broken fixture")
+
+ @pytest.mark.xfail(True, reason="Broken fixtures should result in a
failing setup", strict=True)
+ def test_uses_broken_uncached_fixture(self, broken_uncached_fixture):
+ type(self).num_uses_broken_fixture += 1
+
+ def test_num_uses_uncached(self):
+ assert self.num_uses_broken_uncached_fixture == 0
+
+ @tvm.testing.fixture(cache_return_value=True)
+ def broken_cached_fixture(self):
+ raise RuntimeError("Intentionally broken fixture")
+
+ @pytest.mark.xfail(True, reason="Broken fixtures should result in a
failing setup", strict=True)
+ def test_uses_broken_cached_fixture(self, broken_cached_fixture):
+ type(self).num_uses_broken_cached_fixture += 1
+
+ def test_num_uses_cached(self):
Review comment:
As mentioned in our conversation yesterday, I've added a comment
regarding pytest-xdist and the link to the above stackoverflow post to this PR,
so that it will be easier to find if/when we parallelize the testing.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]