Skip to content

Commit

Permalink
Concurrent custom branch check
Browse files Browse the repository at this point in the history
  • Loading branch information
Zac-HD committed Mar 24, 2024
1 parent ed9a34f commit 284c99b
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ jobs:
path: |
hypothesis-python/.coverage*
!hypothesis-python/.coveragerc
hypothesis-python/branch-check
hypothesis-python/branch-check*
test-win:
runs-on: windows-latest
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# generic build components

.runtimes
/hypothesis-python/branch-check
/hypothesis-python/branch-check*
/pythonpython3.*
/pythonpypy3.*
.pyodide-xbuildenv
Expand Down
6 changes: 4 additions & 2 deletions hypothesis-python/scripts/validate_branch_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
import json
import sys
from collections import defaultdict
from pathlib import Path

if __name__ == "__main__":
with open("branch-check", encoding="utf-8") as i:
data = [json.loads(l) for l in i]
data = []
for p in Path.cwd().glob("branch-check*"):
data.extend(json.loads(l) for l in p.read_text("utf-8").splitlines())

checks = defaultdict(set)

Expand Down
2 changes: 1 addition & 1 deletion hypothesis-python/src/hypothesis/internal/coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def record_branch(name, value):
if key in written:
return
written.add(key)
with open("branch-check", mode="a", encoding="utf-8") as log:
with open(f"branch-check-{os.getpid()}", mode="a", encoding="utf-8") as log:
log.write(json.dumps({"name": name, "value": value}) + "\n")

description_stack = []
Expand Down
2 changes: 1 addition & 1 deletion hypothesis-python/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ setenv=
PYTHONWARNDEFAULTENCODING=1
HYPOTHESIS_INTERNAL_COVERAGE=true
commands_pre =
rm -f branch-check
rm -f branch-check*
pip install .[zoneinfo]
# Produce a coverage report even if the test suite fails.
# (The tox task will still count as failed.)
Expand Down

0 comments on commit 284c99b

Please sign in to comment.