diff options
author | Andrei Zeliankou <zelenkov@nginx.com> | 2021-05-17 15:39:15 +0100 |
---|---|---|
committer | Andrei Zeliankou <zelenkov@nginx.com> | 2021-05-17 15:39:15 +0100 |
commit | 1198118b3b987930c508d78d90af909eec1835db (patch) | |
tree | 7b445c2d1df552f03d92d73f122729b7e74a46c7 /test | |
parent | c216f26d3040beef46ca25f73e580153c4c59d02 (diff) | |
download | unit-1198118b3b987930c508d78d90af909eec1835db.tar.gz unit-1198118b3b987930c508d78d90af909eec1835db.tar.bz2 |
Tests: fixed incorrect "--restart" mode performing.
Diffstat (limited to 'test')
-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) |