Skip to content

Re-add tests/ directory #3314

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
25 changes: 5 additions & 20 deletions src/trio/_core/_tests/test_thread_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
4 changes: 3 additions & 1 deletion src/trio/_core/_thread_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading