kopia lustrzana https://github.com/jupyterhub/repo2docker
Add test for utils.chdir
rodzic
ee9b150ef8
commit
b441176a6a
|
@ -1,6 +1,8 @@
|
|||
"""
|
||||
Tests for repo2docker/utils.py
|
||||
"""
|
||||
import os
|
||||
from tempfile import TemporaryDirectory
|
||||
from repo2docker import utils
|
||||
import pytest
|
||||
import subprocess
|
||||
|
@ -34,4 +36,12 @@ def test_capture_cmd_capture_fail():
|
|||
for line in utils.execute_cmd([
|
||||
'/bin/bash', '-c', 'echo test; exit 1 '
|
||||
], capture=True):
|
||||
assert line == 'test\n'
|
||||
assert line == 'test\n'
|
||||
|
||||
|
||||
def test_chdir():
|
||||
with TemporaryDirectory() as d:
|
||||
cur_cwd = os.getcwd()
|
||||
with utils.chdir(d):
|
||||
assert os.getcwd() == d
|
||||
assert os.getcwd() == cur_cwd
|
||||
|
|
Ładowanie…
Reference in New Issue