|
28 | 28 | from pathlib import Path |
29 | 29 | import re |
30 | 30 | import shutil |
31 | | -import tempfile |
32 | 31 | import time |
33 | 32 | from unittest.mock import patch |
34 | 33 | from warnings import catch_warnings |
@@ -2276,43 +2275,6 @@ def test_use_vtk(mapdl, cleared): |
2276 | 2275 | mapdl.use_vtk = prev |
2277 | 2276 |
|
2278 | 2277 |
|
2279 | | -@requires("local") |
2280 | | -@pytest.mark.xfail(reason="Flaky test. See #2435") |
2281 | | -def test_remove_temp_dir_on_exit(mapdl, cleared, tmpdir): |
2282 | | - path = os.path.join(tempfile.gettempdir(), "ansys_" + random_string()) |
2283 | | - os.makedirs(path) |
2284 | | - filename = os.path.join(path, "file.txt") |
2285 | | - with open(filename, "w") as f: |
2286 | | - f.write("Hello World") |
2287 | | - assert os.path.exists(filename) |
2288 | | - |
2289 | | - prev = mapdl.remove_temp_dir_on_exit |
2290 | | - mapdl.remove_temp_dir_on_exit = True |
2291 | | - mapdl._local = True # Sanity check |
2292 | | - mapdl._remove_temp_dir_on_exit(path) |
2293 | | - mapdl.remove_temp_dir_on_exit = prev |
2294 | | - |
2295 | | - assert os.path.exists(filename) is False |
2296 | | - assert os.path.exists(path) is False |
2297 | | - |
2298 | | - |
2299 | | -@requires("local") |
2300 | | -@requires("nostudent") |
2301 | | -@pytest.mark.xfail(reason="Flaky test. See #2435") |
2302 | | -def test_remove_temp_dir_on_exit_with_launch_mapdl(mapdl, cleared): |
2303 | | - |
2304 | | - mapdl_2 = launch_mapdl(remove_temp_dir_on_exit=True, port=PORT1) |
2305 | | - path_ = mapdl_2.directory |
2306 | | - assert os.path.exists(path_) |
2307 | | - |
2308 | | - pids = mapdl_2._pids |
2309 | | - assert all([psutil.pid_exists(pid) for pid in pids]) # checking pids too |
2310 | | - |
2311 | | - mapdl_2.exit() |
2312 | | - assert not os.path.exists(path_) |
2313 | | - assert not all([psutil.pid_exists(pid) for pid in pids]) |
2314 | | - |
2315 | | - |
2316 | 2278 | def test_sys(mapdl, cleared): |
2317 | 2279 | assert "hi" in mapdl.sys("echo 'hi'") |
2318 | 2280 |
|
|
0 commit comments