A helper class transformers.test_utils.TestCasePlus comes to help: | |
thon | |
from transformers.testing_utils import TestCasePlus | |
class EnvExampleTest(TestCasePlus): | |
def test_external_prog(self): | |
env = self.get_env() | |
# now call the external program, passing env to it | |
Depending on whether the test file was under the tests test suite or examples it'll correctly set up | |
env[PYTHONPATH] to include one of these two directories, and also the src directory to ensure the testing is | |
done against the current repo, and finally with whatever env[PYTHONPATH] was already set to before the test was | |
called if anything. |