INNER CODE UNIT · Python
change_test_dir
awslabs/awsome-distributed-ai · conftest.py:10
def change_test_dir(request):
_orig_dir = os.getcwd()
os.chdir(os.path.dirname(request.path))
yield
os.chdir(_orig_dir)
@pytest.fixture
def docker_build(change_test_dir, request):
img_list = []
def _build(name, dockerfile, test_tag=".test"):
img_name=name + test_tag
subprocess.check_call(['docker', 'build', '-t', img_name, '-f', dockerfile, '.'])
img_list.append(img_name)
return img_name
yield _build
if request.config.option.keep_artifacts is None:
for img in img_list: