diff --git a/pyproject.toml b/pyproject.toml index bec87cfef..dd5a90690 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -305,13 +305,15 @@ omit = [ "*/trio/_tests/check_type_completeness.py", # Script to generate a CFFI interface for the Windows kernel "*/trio/_tools/windows_ffi_build.py", + # pytest plugin (I'm not sure why this doesn't work) + "tests/_trio_check_attrs_aliases.py", ] # The test suite spawns subprocesses to test some stuff, so make sure # this doesn't corrupt the coverage files parallel = true plugins = [] relative_files = true -source = ["trio"] +source = ["trio", "tests/"] [tool.coverage.report] precision = 1 diff --git a/src/trio/_core/_tests/test_thread_cache.py b/src/trio/_core/_tests/test_thread_cache.py index a308befb6..ad878294d 100644 --- a/src/trio/_core/_tests/test_thread_cache.py +++ b/src/trio/_core/_tests/test_thread_cache.py @@ -220,23 +220,8 @@ def foo() -> None: if child_pid != 0: # if this test fails, this will hang, triggering a timeout. os.waitpid(child_pid, 0) - else: - # this is necessary because os._exit doesn't unwind the stack, - # so coverage doesn't get to automatically stop and save - # coverage information. - try: - import coverage - - cov = coverage.Coverage.current() - # the following pragmas are necessary because if coverage: - # - isn't running, then it can't record the branch not - # taken - # - isn't installed, then it can't record the ImportError - - if cov: # pragma: no branch - cov.stop() - cov.save() - except ImportError: # pragma: no cover - pass - - os._exit(0) # pragma: no cover # coverage was stopped above. + else: # pragma: no cover # coverage is shut down by os._exit(0) + # we would *want* to allow coverage to take a snapshot here. check + # git glame for how to do that. however, that times out for some + # reason when having `tests/` in `source` for coverage.py. + os._exit(0) diff --git a/src/trio/_core/_thread_cache.py b/src/trio/_core/_thread_cache.py index 44820e771..c2b2315bd 100644 --- a/src/trio/_core/_thread_cache.py +++ b/src/trio/_core/_thread_cache.py @@ -303,7 +303,9 @@ def start_thread_soon( THREAD_CACHE.start_thread_soon(fn, deliver, name) -def clear_worker_threads() -> None: +def clear_worker_threads() -> ( + None +): # pragma: no cover # see test_clear_thread_cache_after_fork # This is OK because the child process does not actually have any # worker threads. Additionally, while WorkerThread keeps a strong # reference and so would get affected, the only place those are