Skip to content

Commit

Permalink
[UnitTests] More careful removal of fixture functions from module glo…
Browse files Browse the repository at this point in the history
…bal scope.

- Initial implementation only checked hasattr(obj, "_pytestfixturefunction")
  before removing obj, which gave false positives for objects that implement
  __getattr__, such as caffe.layers.  Now, also check that the value
  contained is a FixtureFunctionMarker.
  • Loading branch information
Lunderberg committed Jun 9, 2021
1 parent 9b59706 commit 449fbf8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion python/tvm/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def test_something():
import sys
import time
import pytest
import _pytest
import numpy as np
import tvm
import tvm.arith
Expand Down Expand Up @@ -1184,7 +1185,9 @@ def _remove_global_fixture_definitions(items):
for module in modules:
for name in dir(module):
obj = getattr(module, name)
if hasattr(obj, "_pytestfixturefunction"):
if hasattr(obj, "_pytestfixturefunction") and isinstance(
obj._pytestfixturefunction, _pytest.fixtures.FixtureFunctionMarker
):
delattr(module, name)


Expand Down

0 comments on commit 449fbf8

Please sign in to comment.