Unverified Commit 95e95b6d authored by Frank Lee's avatar Frank Lee Committed by GitHub
Browse files

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

parent 4da324cd
""" """
This file will not be automatically imported by `colossalai.testing` This file will not be automatically imported by `colossalai.testing`
as this file has a dependency on `pytest`. Therefore, you need to as this file has a dependency on `pytest`. Therefore, you need to
explicitly import this file `from colossalai.testing.pytest_wrapper import <func>`.from explicitly import this file `from colossalai.testing.pytest_wrapper import <func>`.from
""" """
import pytest
import os import os
...@@ -30,6 +29,12 @@ def run_on_environment_flag(name: str): ...@@ -30,6 +29,12 @@ def run_on_environment_flag(name: str):
pytest test_for_something.py 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) assert isinstance(name, str)
flag = os.environ.get(name.upper(), '0') flag = os.environ.get(name.upper(), '0')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment