diff options
-rw-r--r-- | test/conftest.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/test/conftest.py b/test/conftest.py index c2781571..5ea4e49d 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -355,7 +355,9 @@ def run(request): fds_diff = waitforfds(lambda: _count_fds(ps['pid']) - ps['fds']) ps['fds'] += fds_diff - assert ps['pid'] == ps_pid, 'same pid %s' % name + if not option.restart: + assert ps['pid'] == ps_pid, 'same pid %s' % name + assert fds_diff <= option.fds_threshold, ( 'descriptors leak %s' % name ) @@ -573,7 +575,7 @@ def _count_fds(pid): ).decode() return len(out.splitlines()) - except (FileNotFoundError, subprocess.CalledProcessError): + except (FileNotFoundError, TypeError, subprocess.CalledProcessError): pass try: @@ -582,7 +584,7 @@ def _count_fds(pid): ).decode() return len(out.splitlines()) - except (FileNotFoundError, subprocess.CalledProcessError): + except (FileNotFoundError, TypeError, subprocess.CalledProcessError): pass return 0 @@ -675,6 +677,6 @@ def pytest_sessionfinish(session): public_dir(option.cache_dir) shutil.rmtree(option.cache_dir) - if not option.save_log: + if not option.save_log and os.path.isdir(option.temp_dir): public_dir(option.temp_dir) shutil.rmtree(option.temp_dir) |