File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66from pathlib import Path
77from unittest .mock import patch
88
9- from test .test_tools import skip_if_missing , imports_under_tool
9+ from test .support import os_helper
10+ from test .test_tools import basepath , skip_if_missing , imports_under_tool
1011
1112skip_if_missing ("build" )
1213
1516 compute_changes = importlib .import_module ("compute-changes" )
1617
1718process_changed_files = compute_changes .process_changed_files
19+ is_fuzzable_library_file = compute_changes .is_fuzzable_library_file
1820Outputs = compute_changes .Outputs
1921ANDROID_DIRS = compute_changes .ANDROID_DIRS
2022IOS_DIRS = compute_changes .IOS_DIRS
@@ -45,16 +47,16 @@ def test_docs(self):
4547 self .assertFalse (result .run_tests )
4648
4749 def test_ci_fuzz_stdlib (self ):
48- for p in LIBRARY_FUZZER_PATHS :
49- with self . subTest ( p = p ) :
50- if p . is_dir ( ):
51- f = p / "file"
52- elif p . is_file ():
53- f = p
54- else :
55- continue
56- result = process_changed_files ({ f } )
57- self .assertTrue (result . run_ci_fuzz_stdlib )
50+ with os_helper . change_cwd ( basepath ) :
51+ for p in LIBRARY_FUZZER_PATHS :
52+ with self . subTest ( p = p ):
53+ if p . is_dir ():
54+ f = p / "file"
55+ elif p . is_file ():
56+ f = p
57+ result = process_changed_files ({ f })
58+ self . assertTrue ( result . run_ci_fuzz_stdlib )
59+ self .assertTrue (is_fuzzable_library_file ( f ) )
5860
5961 def test_android (self ):
6062 for d in ANDROID_DIRS :
Original file line number Diff line number Diff line change 6868 Path ("Lib/encodings/" ),
6969 Path ("Modules/_codecsmodule.c" ),
7070 Path ("Modules/cjkcodecs/" ),
71- Path ("Modules/unicodedata*" ),
71+ Path ("Modules/unicodedata.c" ),
72+ Path ("Modules/unicodedata_db.h" ),
7273 # difflib
7374 Path ("Lib/difflib.py" ),
7475 # email
@@ -116,10 +117,10 @@ class Outputs:
116117
117118
118119def compute_changes () -> None :
119- target_branch , head_ref = git_refs ()
120+ target_ref , head_ref = git_refs ()
120121 if os .environ .get ("GITHUB_EVENT_NAME" , "" ) == "pull_request" :
121122 # Getting changed files only makes sense on a pull request
122- files = get_changed_files (target_branch , head_ref )
123+ files = get_changed_files (target_ref , head_ref )
123124 outputs = process_changed_files (files )
124125 else :
125126 # Otherwise, just run the tests
@@ -132,6 +133,7 @@ def compute_changes() -> None:
132133 run_wasi = True ,
133134 run_windows_tests = True ,
134135 )
136+ target_branch = target_ref .removeprefix ("origin/" )
135137 outputs = process_target_branch (outputs , target_branch )
136138
137139 if outputs .run_tests :
You can’t perform that action at this time.
0 commit comments