MCPcopy Index your code
hub / github.com/datacamp/pythonwhat / test_run_with_absolute_dir

Function test_run_with_absolute_dir

tests/test_local.py:146–170  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

144
145
146def test_run_with_absolute_dir():
147 code = 'from pathlib import Path; c = Path("c").read_text(encoding="utf-8")'
148
149 file_dir = "a/b"
150 solution_location = "solution"
151 workspace_location = "workspace"
152
153 with in_temp_dir():
154 os.makedirs(file_dir)
155 with ChDir(file_dir):
156 abs_dir = os.path.abspath(".")
157 abs_file_path = Path(abs_dir, "c")
158 with open("c", "w") as f:
159 f.write(code)
160
161 write_file(solution_location, "c", code)
162
163 os.makedirs(workspace_location)
164 with ChDir(workspace_location):
165 chain = setup_state("", "", pec="")
166
167 child = chain.check_file(abs_file_path, solution_code=code)
168
169 child.run(abs_dir).check_object("c")
170 child.run().check_object("c")
171
172
173def test_run_custom_solution_dir():

Callers

nothing calls this directly

Calls 5

in_temp_dirFunction · 0.90
ChDirClass · 0.90
setup_stateFunction · 0.90
write_fileFunction · 0.85
runMethod · 0.80

Tested by

no test coverage detected