[testing] move pytest to be inside the function (#4087)

pull/4105/head
Frank Lee 1 year ago committed by GitHub
parent 4da324cd60
commit 95e95b6d58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -4,7 +4,6 @@ as this file has a dependency on `pytest`. Therefore, you need to
explicitly import this file `from colossalai.testing.pytest_wrapper import <func>`.from
"""
import pytest
import os
@ -30,6 +29,12 @@ def run_on_environment_flag(name: str):
pytest test_for_something.py
"""
try:
import pytest
except ImportError:
raise ImportError(
'This function requires `pytest` to be installed, please do `pip install pytest` and try again.')
assert isinstance(name, str)
flag = os.environ.get(name.upper(), '0')

Loading…
Cancel
Save