Skip to content

Commit b314d89

Browse files
authored
Get coverage to 100% (#61)
1 parent 7a64280 commit b314d89

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/test_unasync.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import copy
2+
import errno
23
import io
34
import os
45
import shutil
@@ -72,6 +73,8 @@ def test_build_py_modules(tmpdir):
7273
env = copy.copy(os.environ)
7374
env["PYTHONPATH"] = os.path.realpath(os.path.join(TEST_DIR, ".."))
7475
subprocess.check_call(["python", "setup.py", "build"], cwd=mod_dir, env=env)
76+
# Calling it twice to test the "if not copied" branch
77+
subprocess.check_call(["python", "setup.py", "build"], cwd=mod_dir, env=env)
7578

7679
unasynced = os.path.join(mod_dir, "build/lib/_sync/some_file.py")
7780
tree_build_dir = list_files(mod_dir)
@@ -136,3 +139,13 @@ def test_project_structure_after_customized_build_py_packages(tmpdir):
136139

137140
with open(os.path.join(unasynced_dir_path, "tests/test_conn.py")) as f:
138141
assert "import hip\n" in f.read()
142+
143+
144+
def test_makedirs_existok(monkeypatch):
145+
def raises(*args, **kwargs):
146+
# Unexpected OSError
147+
raise OSError(errno.EPERM, "Operation not permitted")
148+
149+
monkeypatch.setattr(os, "makedirs", raises)
150+
with pytest.raises(OSError):
151+
unasync._makedirs_existok("path")

0 commit comments

Comments
 (0)