Skip to content

Commit 604746c

Browse files
committed
[GR-22564] Simplify the retagger tag construction
PullRequest: graalpython/955
2 parents 19cf265 + 7c68964 commit 604746c

File tree

289 files changed

+7610
-4669
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

289 files changed

+7610
-4669
lines changed

graalpython/com.oracle.graal.python.test/src/tests/test_tagged_unittests.py

Lines changed: 9 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -187,25 +187,6 @@ def parse_unittest_output(output):
187187
print(p.stderr)
188188

189189
passing_tests = []
190-
failed_tests = []
191-
192-
def get_pass_name(funcname, classname):
193-
try:
194-
imported_test_module = __import__(testmod)
195-
except Exception:
196-
pass
197-
else:
198-
# try hard to get a most specific pattern
199-
classname = "".join(classname.rpartition(testmod)[1:])
200-
clazz = imported_test_module
201-
path_to_class = classname.split(".")[1:]
202-
for part in path_to_class:
203-
clazz = getattr(clazz, part, None)
204-
if clazz:
205-
func = getattr(clazz, funcname, None)
206-
if func:
207-
return func.__qualname__
208-
return funcname
209190

210191
stderr = p.stderr.replace("Please note: This Python implementation is in the very early stages, and can run little more than basic benchmarks at this point.\n", '')
211192

@@ -215,30 +196,25 @@ def get_pass_name(funcname, classname):
215196
# We consider skipped tests as passing in order to avoid a situation where a Linux run
216197
# untags a Darwin-only test and vice versa
217198
if result == 'ok' or result.startswith('skipped'):
218-
passing_tests.append("*" + get_pass_name(funcname, classname))
219-
else:
220-
failed_tests.append("*" + get_pass_name(funcname, classname))
221-
222-
# n.b.: unittests uses the __qualname__ of the function as
223-
# pattern, which we're trying to do as well. however, sometimes
224-
# the same function is shared in multiple test classes, and
225-
# fails in some. so we always subtract the failed patterns from
226-
# the passed patterns
227-
passing_only_patterns = set(passing_tests) - set(failed_tests)
199+
passing_tests.append(f"*{classname}.{funcname}")
200+
228201
with open(tagfile, "w") as f:
229-
for passing_test in sorted(passing_only_patterns):
202+
for passing_test in sorted(passing_tests):
230203
f.write(passing_test)
231204
f.write("\n")
232-
if not passing_only_patterns:
205+
if not passing_tests:
233206
os.unlink(tagfile)
234207
print("No successful tests remaining")
235208
break
236209

237210
if p.returncode == 0:
238-
print(f"Suite succeeded with {len(passing_only_patterns)} tests")
211+
if repeat == 0 and maxrepeats > 1:
212+
print(f"Suite succeeded with {len(passing_tests)} tests, retrying to confirm tags are correct")
213+
continue
214+
print(f"Suite succeeded with {len(passing_tests)} tests")
239215
break
240216
else:
241-
print(f"Suite failed, retrying with {len(passing_only_patterns)} tests")
217+
print(f"Suite failed, retrying with {len(passing_tests)} tests")
242218

243219
else:
244220
# we tried the last time and failed, so our tags don't work for
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
*FutureTest.test_attributes
2-
*FutureTest.test_names
1+
*graalpython.lib-python.3.test.test___future__.FutureTest.test_attributes
2+
*graalpython.lib-python.3.test.test___future__.FutureTest.test_names
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*_LocaleTests.test_float_parsing
2-
*_LocaleTests.test_lc_numeric_basic
3-
*_LocaleTests.test_lc_numeric_localeconv
4-
*_LocaleTests.test_lc_numeric_nl_langinfo
1+
*graalpython.lib-python.3.test.test__locale._LocaleTests.test_float_parsing
2+
*graalpython.lib-python.3.test.test__locale._LocaleTests.test_lc_numeric_basic
3+
*graalpython.lib-python.3.test.test__locale._LocaleTests.test_lc_numeric_localeconv
4+
*graalpython.lib-python.3.test.test__locale._LocaleTests.test_lc_numeric_nl_langinfo
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
*Test_OSXSupport.test__check_for_unavailable_sdk
2-
*Test_OSXSupport.test__find_build_tool
3-
*Test_OSXSupport.test__find_executable
4-
*Test_OSXSupport.test__get_system_version
5-
*Test_OSXSupport.test__override_all_archs
6-
*Test_OSXSupport.test__remove_original_values
7-
*Test_OSXSupport.test__remove_universal_flags
8-
*Test_OSXSupport.test__save_modified_value
9-
*Test_OSXSupport.test__save_modified_value_unchanged
10-
*Test_OSXSupport.test_get_platform_osx
1+
*graalpython.lib-python.3.test.test__osx_support.Test_OSXSupport.test__check_for_unavailable_sdk
2+
*graalpython.lib-python.3.test.test__osx_support.Test_OSXSupport.test__find_build_tool
3+
*graalpython.lib-python.3.test.test__osx_support.Test_OSXSupport.test__find_executable
4+
*graalpython.lib-python.3.test.test__osx_support.Test_OSXSupport.test__get_system_version
5+
*graalpython.lib-python.3.test.test__osx_support.Test_OSXSupport.test__override_all_archs
6+
*graalpython.lib-python.3.test.test__osx_support.Test_OSXSupport.test__remove_original_values
7+
*graalpython.lib-python.3.test.test__osx_support.Test_OSXSupport.test__remove_universal_flags
8+
*graalpython.lib-python.3.test.test__osx_support.Test_OSXSupport.test__save_modified_value
9+
*graalpython.lib-python.3.test.test__osx_support.Test_OSXSupport.test__save_modified_value_unchanged
10+
*graalpython.lib-python.3.test.test__osx_support.Test_OSXSupport.test_get_platform_osx
Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
*test_ABC_has___slots__
2-
*test_abstractmethod_basics
3-
*test_all_new_methods_are_called
4-
*test_isinstance_invalidation
5-
*test_issubclass_bad_arguments
6-
*test_metaclass_abc
7-
*test_register_as_class_deco
8-
*test_register_non_class
9-
*test_registration_basics
10-
*test_registration_builtins
11-
*test_registration_edge_cases
12-
*test_registration_transitiveness
13-
*test_tricky_new_works
14-
*test_works_with_init_subclass
1+
*graalpython.lib-python.3.test.test_abc.test_factory.<locals>.TestABC.test_ABC_has___slots__
2+
*graalpython.lib-python.3.test.test_abc.test_factory.<locals>.TestABC.test_abstractmethod_basics
3+
*graalpython.lib-python.3.test.test_abc.test_factory.<locals>.TestABC.test_all_new_methods_are_called
4+
*graalpython.lib-python.3.test.test_abc.test_factory.<locals>.TestABC.test_isinstance_invalidation
5+
*graalpython.lib-python.3.test.test_abc.test_factory.<locals>.TestABC.test_issubclass_bad_arguments
6+
*graalpython.lib-python.3.test.test_abc.test_factory.<locals>.TestABC.test_metaclass_abc
7+
*graalpython.lib-python.3.test.test_abc.test_factory.<locals>.TestABC.test_register_as_class_deco
8+
*graalpython.lib-python.3.test.test_abc.test_factory.<locals>.TestABC.test_register_non_class
9+
*graalpython.lib-python.3.test.test_abc.test_factory.<locals>.TestABC.test_registration_basics
10+
*graalpython.lib-python.3.test.test_abc.test_factory.<locals>.TestABC.test_registration_builtins
11+
*graalpython.lib-python.3.test.test_abc.test_factory.<locals>.TestABC.test_registration_edge_cases
12+
*graalpython.lib-python.3.test.test_abc.test_factory.<locals>.TestABC.test_registration_transitiveness
13+
*graalpython.lib-python.3.test.test_abc.test_factory.<locals>.TestABC.test_tricky_new_works
14+
*graalpython.lib-python.3.test.test_abc.test_factory.<locals>.TestABCWithInitSubclass.test_works_with_init_subclass
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
*TestNumbers.test_complex
2-
*TestNumbers.test_float
3-
*TestNumbers.test_int
1+
*graalpython.lib-python.3.test.test_abstract_numbers.TestNumbers.test_complex
2+
*graalpython.lib-python.3.test.test_abstract_numbers.TestNumbers.test_float
3+
*graalpython.lib-python.3.test.test_abstract_numbers.TestNumbers.test_int
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*AST_Tests.test_AST_garbage_collection
2-
*AST_Tests.test_field_attr_writable
3-
*AST_Tests.test_issue31592
4-
*AST_Tests.test_realtype
1+
*graalpython.lib-python.3.test.test_ast.AST_Tests.test_AST_garbage_collection
2+
*graalpython.lib-python.3.test.test_ast.AST_Tests.test_field_attr_writable
3+
*graalpython.lib-python.3.test.test_ast.AST_Tests.test_issue31592
4+
*graalpython.lib-python.3.test.test_ast.AST_Tests.test_realtype
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
*DispatcherTests.test_basic
2-
*DispatcherTests.test_log
3-
*DispatcherTests.test_log_info
4-
*DispatcherTests.test_repr
5-
*DispatcherTests.test_strerror
6-
*DispatcherTests.test_unhandled
7-
*HelperFunctionTests.test_closeall
8-
*HelperFunctionTests.test_closeall_default
9-
*HelperFunctionTests.test_compact_traceback
10-
*HelperFunctionTests.test_readwrite
11-
*HelperFunctionTests.test_readwriteexc
1+
*graalpython.lib-python.3.test.test_asyncore.DispatcherTests.test_basic
2+
*graalpython.lib-python.3.test.test_asyncore.DispatcherTests.test_log
3+
*graalpython.lib-python.3.test.test_asyncore.DispatcherTests.test_log_info
4+
*graalpython.lib-python.3.test.test_asyncore.DispatcherTests.test_repr
5+
*graalpython.lib-python.3.test.test_asyncore.DispatcherTests.test_strerror
6+
*graalpython.lib-python.3.test.test_asyncore.DispatcherTests.test_unhandled
7+
*graalpython.lib-python.3.test.test_asyncore.HelperFunctionTests.test_closeall
8+
*graalpython.lib-python.3.test.test_asyncore.HelperFunctionTests.test_closeall_default
9+
*graalpython.lib-python.3.test.test_asyncore.HelperFunctionTests.test_compact_traceback
10+
*graalpython.lib-python.3.test.test_asyncore.HelperFunctionTests.test_readwrite
11+
*graalpython.lib-python.3.test.test_asyncore.HelperFunctionTests.test_readwriteexc
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
*SubinterpreterTest.test_callback_on_subinterpreter_teardown
2-
*SubinterpreterTest.test_callbacks_leak
3-
*SubinterpreterTest.test_callbacks_leak_refcycle
1+
*graalpython.lib-python.3.test.test_atexit.SubinterpreterTest.test_callback_on_subinterpreter_teardown
2+
*graalpython.lib-python.3.test.test_atexit.SubinterpreterTest.test_callbacks_leak
3+
*graalpython.lib-python.3.test.test_atexit.SubinterpreterTest.test_callbacks_leak_refcycle
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
*AuditTest.test_winreg
1+
*graalpython.lib-python.3.test.test_audit.AuditTest.test_winreg

0 commit comments

Comments
 (0)