From 8e4f5c5d993302da20c46c18daa9a748433d6af8 Mon Sep 17 00:00:00 2001 From: William Grant Date: Thu, 22 Sep 2022 16:53:27 -0400 Subject: [PATCH] Move tests to dedicated directory. There are philosophical reasons you might not wish to do this, but it is more standard for python packages and has advantages e.g in not packaging the tests. --- {typed_python => tests}/Codebase_test.py | 0 {typed_python => tests}/array/array_test.py | 0 .../lib/datetime => tests}/chrono_test.py | 0 {typed_python => tests}/class_types_test.py | 2 +- .../tests => tests/compiler}/__init__.py | 0 .../compiler}/alternative_compilation_test.py | 0 .../compiler}/any_all_compilation_test.py | 0 .../compiler}/arithmetic_compilation_test.py | 0 .../compiler}/builtin_compilation_test.py | 0 .../compiler}/bytes_compilation_test.py | 0 .../compiler}/class_compilation_test.py | 0 .../tests => tests/compiler}/closures_test.py | 0 .../compiler/compiler_cache_test.py | 0 .../compiler_typed_python_comparison_test.py | 0 .../compiling_type_operations_test.py | 0 .../compiler}/const_dict_compilation_test.py | 0 .../compiler}/conversion_test.py | 0 .../compiler}/dict_compilation_test.py | 0 .../compiler}/entrypoint_test.py | 0 .../compiler}/exception_handling_test.py | 0 .../compiler}/exceptions_from_c_code_test.py | 0 .../function_signature_calculator_test.py | 0 .../compiler}/generators_test.py | 0 .../compiler}/hash_compilation_test.py | 0 .../compiler}/held_class_compilation_test.py | 0 .../held_class_interpreter_semantics_test.py | 0 .../compiler}/isinstance_compilation_test.py | 0 .../compiler}/list_of_compilation_test.py | 0 .../compiler/llvm_compiler_test.py | 0 .../compiler}/masquerade_test.py | 0 .../math_functions_compilation_test.py | 0 .../compiler/merge_type_wrappers_test.py | 0 .../compiler}/multithreading_test.py | 0 .../named_tuple_subclass_compilation_test.py | 0 .../compiler/native_ast_to_llvm_test.py | 0 .../compiler}/numpy_interaction_test.py | 0 .../compiler}/one_of_compilation_test.py | 0 .../compiler}/operator_is_compilation_test.py | 0 .../compiler}/pointer_to_compilation_test.py | 0 .../compiler/python_ast_analysis_test.py | 0 .../python_object_of_type_compilation_test.py | 0 .../compiler}/range_compilation_test.py | 0 .../serialization_compilation_test.py | 0 .../compiler}/set_compilation_test.py | 0 .../compiler}/string_compilation_test.py | 0 .../compiler}/subclass_of_test.py | 0 .../compiler}/time_compilation_test.py | 0 .../compiler}/tuple_compilation_test.py | 0 .../compiler}/tuple_of_compilation_test.py | 0 .../compiler}/type_conversion_test.py | 0 .../type_function_compilation_test.py | 0 .../compiler}/type_inference_test.py | 0 .../type_of_instances_compilation_test.py | 0 .../typed_function_compilation_test.py | 0 .../datetime => tests}/date_formatter_test.py | 0 .../datetime => tests}/date_parser_test.py | 0 .../lib/datetime => tests}/date_time_test.py | 2 +- .../datetime => tests}/date_time_util_test.py | 0 .../deep_bytecount_test.py | 0 {typed_python => tests}/deepcopy_test.py | 0 {typed_python => tests}/forward_types_test.py | 0 .../function_signature_test.py | 0 .../function_types_test.py | 0 {typed_python => tests}/macro_test.py | 0 {typed_python/lib => tests}/map_test.py | 0 .../module_representation_test.py | 0 {typed_python => tests}/module_test.py | 0 {typed_python/lib => tests}/pmap_test.py | 0 {typed_python => tests}/python_ast_test.py | 0 {typed_python/lib => tests}/reduce_test.py | 0 .../lib => tests}/sorted_dict_test.py | 0 {typed_python/lib => tests}/sorting_test.py | 0 {typed_python/lib => tests}/timestamp_test.py | 0 {typed_python => tests}/type_function_test.py | 2 +- {typed_python => tests}/type_identity_test.py | 5 +- {typed_python => tests}/typed_queue_test.py | 0 .../types_metadata_test.py | 0 .../types_named_tuple_test.py | 0 .../types_serialization_format_test.py | 0 .../types_serialization_test.py | 94 ++++++++++--------- {typed_python => tests}/types_test.py | 4 +- tox.ini | 2 +- 82 files changed, 60 insertions(+), 51 deletions(-) rename {typed_python => tests}/Codebase_test.py (100%) rename {typed_python => tests}/array/array_test.py (100%) rename {typed_python/lib/datetime => tests}/chrono_test.py (100%) rename {typed_python => tests}/class_types_test.py (99%) rename {typed_python/compiler/tests => tests/compiler}/__init__.py (100%) rename {typed_python/compiler/tests => tests/compiler}/alternative_compilation_test.py (100%) rename {typed_python/compiler/tests => tests/compiler}/any_all_compilation_test.py (100%) rename {typed_python/compiler/tests => tests/compiler}/arithmetic_compilation_test.py (100%) rename {typed_python/compiler/tests => tests/compiler}/builtin_compilation_test.py (100%) rename {typed_python/compiler/tests => tests/compiler}/bytes_compilation_test.py (100%) rename {typed_python/compiler/tests => tests/compiler}/class_compilation_test.py (100%) rename {typed_python/compiler/tests => tests/compiler}/closures_test.py (100%) rename {typed_python => tests}/compiler/compiler_cache_test.py (100%) rename {typed_python/compiler/tests => tests/compiler}/compiler_typed_python_comparison_test.py (100%) rename {typed_python/compiler/tests => tests/compiler}/compiling_type_operations_test.py (100%) rename {typed_python/compiler/tests => tests/compiler}/const_dict_compilation_test.py (100%) rename {typed_python/compiler/tests => tests/compiler}/conversion_test.py (100%) rename {typed_python/compiler/tests => tests/compiler}/dict_compilation_test.py (100%) rename {typed_python/compiler/tests => tests/compiler}/entrypoint_test.py (100%) rename {typed_python/compiler/tests => tests/compiler}/exception_handling_test.py (100%) rename {typed_python/compiler/tests => tests/compiler}/exceptions_from_c_code_test.py (100%) rename {typed_python/compiler/tests => tests/compiler}/function_signature_calculator_test.py (100%) rename {typed_python/compiler/tests => tests/compiler}/generators_test.py (100%) rename {typed_python/compiler/tests => tests/compiler}/hash_compilation_test.py (100%) rename {typed_python/compiler/tests => tests/compiler}/held_class_compilation_test.py (100%) rename {typed_python/compiler/tests => tests/compiler}/held_class_interpreter_semantics_test.py (100%) rename {typed_python/compiler/tests => tests/compiler}/isinstance_compilation_test.py (100%) rename {typed_python/compiler/tests => tests/compiler}/list_of_compilation_test.py (100%) rename {typed_python => tests}/compiler/llvm_compiler_test.py (100%) rename {typed_python/compiler/tests => tests/compiler}/masquerade_test.py (100%) rename {typed_python/compiler/tests => tests/compiler}/math_functions_compilation_test.py (100%) rename {typed_python => tests}/compiler/merge_type_wrappers_test.py (100%) rename {typed_python/compiler/tests => tests/compiler}/multithreading_test.py (100%) rename {typed_python/compiler/tests => tests/compiler}/named_tuple_subclass_compilation_test.py (100%) rename {typed_python => tests}/compiler/native_ast_to_llvm_test.py (100%) rename {typed_python/compiler/tests => tests/compiler}/numpy_interaction_test.py (100%) rename {typed_python/compiler/tests => tests/compiler}/one_of_compilation_test.py (100%) rename {typed_python/compiler/tests => tests/compiler}/operator_is_compilation_test.py (100%) rename {typed_python/compiler/tests => tests/compiler}/pointer_to_compilation_test.py (100%) rename {typed_python => tests}/compiler/python_ast_analysis_test.py (100%) rename {typed_python/compiler/tests => tests/compiler}/python_object_of_type_compilation_test.py (100%) rename {typed_python/compiler/tests => tests/compiler}/range_compilation_test.py (100%) rename {typed_python/compiler/tests => tests/compiler}/serialization_compilation_test.py (100%) rename {typed_python/compiler/tests => tests/compiler}/set_compilation_test.py (100%) rename {typed_python/compiler/tests => tests/compiler}/string_compilation_test.py (100%) rename {typed_python/compiler/tests => tests/compiler}/subclass_of_test.py (100%) rename {typed_python/compiler/tests => tests/compiler}/time_compilation_test.py (100%) rename {typed_python/compiler/tests => tests/compiler}/tuple_compilation_test.py (100%) rename {typed_python/compiler/tests => tests/compiler}/tuple_of_compilation_test.py (100%) rename {typed_python/compiler/tests => tests/compiler}/type_conversion_test.py (100%) rename {typed_python/compiler/tests => tests/compiler}/type_function_compilation_test.py (100%) rename {typed_python/compiler/tests => tests/compiler}/type_inference_test.py (100%) rename {typed_python/compiler/tests => tests/compiler}/type_of_instances_compilation_test.py (100%) rename {typed_python/compiler/tests => tests/compiler}/typed_function_compilation_test.py (100%) rename {typed_python/lib/datetime => tests}/date_formatter_test.py (100%) rename {typed_python/lib/datetime => tests}/date_parser_test.py (100%) rename {typed_python/lib/datetime => tests}/date_time_test.py (99%) rename {typed_python/lib/datetime => tests}/date_time_util_test.py (100%) rename {typed_python => tests}/deep_bytecount_test.py (100%) rename {typed_python => tests}/deepcopy_test.py (100%) rename {typed_python => tests}/forward_types_test.py (100%) rename {typed_python => tests}/function_signature_test.py (100%) rename {typed_python => tests}/function_types_test.py (100%) rename {typed_python => tests}/macro_test.py (100%) rename {typed_python/lib => tests}/map_test.py (100%) rename {typed_python => tests}/module_representation_test.py (100%) rename {typed_python => tests}/module_test.py (100%) rename {typed_python/lib => tests}/pmap_test.py (100%) rename {typed_python => tests}/python_ast_test.py (100%) rename {typed_python/lib => tests}/reduce_test.py (100%) rename {typed_python/lib => tests}/sorted_dict_test.py (100%) rename {typed_python/lib => tests}/sorting_test.py (100%) rename {typed_python/lib => tests}/timestamp_test.py (100%) rename {typed_python => tests}/type_function_test.py (99%) rename {typed_python => tests}/type_identity_test.py (99%) rename {typed_python => tests}/typed_queue_test.py (100%) rename {typed_python => tests}/types_metadata_test.py (100%) rename {typed_python => tests}/types_named_tuple_test.py (100%) rename {typed_python => tests}/types_serialization_format_test.py (100%) rename {typed_python => tests}/types_serialization_test.py (95%) rename {typed_python => tests}/types_test.py (99%) diff --git a/typed_python/Codebase_test.py b/tests/Codebase_test.py similarity index 100% rename from typed_python/Codebase_test.py rename to tests/Codebase_test.py diff --git a/typed_python/array/array_test.py b/tests/array/array_test.py similarity index 100% rename from typed_python/array/array_test.py rename to tests/array/array_test.py diff --git a/typed_python/lib/datetime/chrono_test.py b/tests/chrono_test.py similarity index 100% rename from typed_python/lib/datetime/chrono_test.py rename to tests/chrono_test.py diff --git a/typed_python/class_types_test.py b/tests/class_types_test.py similarity index 99% rename from typed_python/class_types_test.py rename to tests/class_types_test.py index 6ed3a271d..3a9331918 100644 --- a/typed_python/class_types_test.py +++ b/tests/class_types_test.py @@ -91,7 +91,7 @@ def f(self, y) -> str: # noqa: F811 class NativeClassTypesTests(unittest.TestCase): def test_class_name(self): assert ClassWithInit.__name__ == 'ClassWithInit' - assert ClassWithInit.__module__ == 'typed_python.class_types_test' + assert ClassWithInit.__module__ == 'class_types_test' assert ClassWithInit.__qualname__ == 'ClassWithInit' def test_member_default_value(self): diff --git a/typed_python/compiler/tests/__init__.py b/tests/compiler/__init__.py similarity index 100% rename from typed_python/compiler/tests/__init__.py rename to tests/compiler/__init__.py diff --git a/typed_python/compiler/tests/alternative_compilation_test.py b/tests/compiler/alternative_compilation_test.py similarity index 100% rename from typed_python/compiler/tests/alternative_compilation_test.py rename to tests/compiler/alternative_compilation_test.py diff --git a/typed_python/compiler/tests/any_all_compilation_test.py b/tests/compiler/any_all_compilation_test.py similarity index 100% rename from typed_python/compiler/tests/any_all_compilation_test.py rename to tests/compiler/any_all_compilation_test.py diff --git a/typed_python/compiler/tests/arithmetic_compilation_test.py b/tests/compiler/arithmetic_compilation_test.py similarity index 100% rename from typed_python/compiler/tests/arithmetic_compilation_test.py rename to tests/compiler/arithmetic_compilation_test.py diff --git a/typed_python/compiler/tests/builtin_compilation_test.py b/tests/compiler/builtin_compilation_test.py similarity index 100% rename from typed_python/compiler/tests/builtin_compilation_test.py rename to tests/compiler/builtin_compilation_test.py diff --git a/typed_python/compiler/tests/bytes_compilation_test.py b/tests/compiler/bytes_compilation_test.py similarity index 100% rename from typed_python/compiler/tests/bytes_compilation_test.py rename to tests/compiler/bytes_compilation_test.py diff --git a/typed_python/compiler/tests/class_compilation_test.py b/tests/compiler/class_compilation_test.py similarity index 100% rename from typed_python/compiler/tests/class_compilation_test.py rename to tests/compiler/class_compilation_test.py diff --git a/typed_python/compiler/tests/closures_test.py b/tests/compiler/closures_test.py similarity index 100% rename from typed_python/compiler/tests/closures_test.py rename to tests/compiler/closures_test.py diff --git a/typed_python/compiler/compiler_cache_test.py b/tests/compiler/compiler_cache_test.py similarity index 100% rename from typed_python/compiler/compiler_cache_test.py rename to tests/compiler/compiler_cache_test.py diff --git a/typed_python/compiler/tests/compiler_typed_python_comparison_test.py b/tests/compiler/compiler_typed_python_comparison_test.py similarity index 100% rename from typed_python/compiler/tests/compiler_typed_python_comparison_test.py rename to tests/compiler/compiler_typed_python_comparison_test.py diff --git a/typed_python/compiler/tests/compiling_type_operations_test.py b/tests/compiler/compiling_type_operations_test.py similarity index 100% rename from typed_python/compiler/tests/compiling_type_operations_test.py rename to tests/compiler/compiling_type_operations_test.py diff --git a/typed_python/compiler/tests/const_dict_compilation_test.py b/tests/compiler/const_dict_compilation_test.py similarity index 100% rename from typed_python/compiler/tests/const_dict_compilation_test.py rename to tests/compiler/const_dict_compilation_test.py diff --git a/typed_python/compiler/tests/conversion_test.py b/tests/compiler/conversion_test.py similarity index 100% rename from typed_python/compiler/tests/conversion_test.py rename to tests/compiler/conversion_test.py diff --git a/typed_python/compiler/tests/dict_compilation_test.py b/tests/compiler/dict_compilation_test.py similarity index 100% rename from typed_python/compiler/tests/dict_compilation_test.py rename to tests/compiler/dict_compilation_test.py diff --git a/typed_python/compiler/tests/entrypoint_test.py b/tests/compiler/entrypoint_test.py similarity index 100% rename from typed_python/compiler/tests/entrypoint_test.py rename to tests/compiler/entrypoint_test.py diff --git a/typed_python/compiler/tests/exception_handling_test.py b/tests/compiler/exception_handling_test.py similarity index 100% rename from typed_python/compiler/tests/exception_handling_test.py rename to tests/compiler/exception_handling_test.py diff --git a/typed_python/compiler/tests/exceptions_from_c_code_test.py b/tests/compiler/exceptions_from_c_code_test.py similarity index 100% rename from typed_python/compiler/tests/exceptions_from_c_code_test.py rename to tests/compiler/exceptions_from_c_code_test.py diff --git a/typed_python/compiler/tests/function_signature_calculator_test.py b/tests/compiler/function_signature_calculator_test.py similarity index 100% rename from typed_python/compiler/tests/function_signature_calculator_test.py rename to tests/compiler/function_signature_calculator_test.py diff --git a/typed_python/compiler/tests/generators_test.py b/tests/compiler/generators_test.py similarity index 100% rename from typed_python/compiler/tests/generators_test.py rename to tests/compiler/generators_test.py diff --git a/typed_python/compiler/tests/hash_compilation_test.py b/tests/compiler/hash_compilation_test.py similarity index 100% rename from typed_python/compiler/tests/hash_compilation_test.py rename to tests/compiler/hash_compilation_test.py diff --git a/typed_python/compiler/tests/held_class_compilation_test.py b/tests/compiler/held_class_compilation_test.py similarity index 100% rename from typed_python/compiler/tests/held_class_compilation_test.py rename to tests/compiler/held_class_compilation_test.py diff --git a/typed_python/compiler/tests/held_class_interpreter_semantics_test.py b/tests/compiler/held_class_interpreter_semantics_test.py similarity index 100% rename from typed_python/compiler/tests/held_class_interpreter_semantics_test.py rename to tests/compiler/held_class_interpreter_semantics_test.py diff --git a/typed_python/compiler/tests/isinstance_compilation_test.py b/tests/compiler/isinstance_compilation_test.py similarity index 100% rename from typed_python/compiler/tests/isinstance_compilation_test.py rename to tests/compiler/isinstance_compilation_test.py diff --git a/typed_python/compiler/tests/list_of_compilation_test.py b/tests/compiler/list_of_compilation_test.py similarity index 100% rename from typed_python/compiler/tests/list_of_compilation_test.py rename to tests/compiler/list_of_compilation_test.py diff --git a/typed_python/compiler/llvm_compiler_test.py b/tests/compiler/llvm_compiler_test.py similarity index 100% rename from typed_python/compiler/llvm_compiler_test.py rename to tests/compiler/llvm_compiler_test.py diff --git a/typed_python/compiler/tests/masquerade_test.py b/tests/compiler/masquerade_test.py similarity index 100% rename from typed_python/compiler/tests/masquerade_test.py rename to tests/compiler/masquerade_test.py diff --git a/typed_python/compiler/tests/math_functions_compilation_test.py b/tests/compiler/math_functions_compilation_test.py similarity index 100% rename from typed_python/compiler/tests/math_functions_compilation_test.py rename to tests/compiler/math_functions_compilation_test.py diff --git a/typed_python/compiler/merge_type_wrappers_test.py b/tests/compiler/merge_type_wrappers_test.py similarity index 100% rename from typed_python/compiler/merge_type_wrappers_test.py rename to tests/compiler/merge_type_wrappers_test.py diff --git a/typed_python/compiler/tests/multithreading_test.py b/tests/compiler/multithreading_test.py similarity index 100% rename from typed_python/compiler/tests/multithreading_test.py rename to tests/compiler/multithreading_test.py diff --git a/typed_python/compiler/tests/named_tuple_subclass_compilation_test.py b/tests/compiler/named_tuple_subclass_compilation_test.py similarity index 100% rename from typed_python/compiler/tests/named_tuple_subclass_compilation_test.py rename to tests/compiler/named_tuple_subclass_compilation_test.py diff --git a/typed_python/compiler/native_ast_to_llvm_test.py b/tests/compiler/native_ast_to_llvm_test.py similarity index 100% rename from typed_python/compiler/native_ast_to_llvm_test.py rename to tests/compiler/native_ast_to_llvm_test.py diff --git a/typed_python/compiler/tests/numpy_interaction_test.py b/tests/compiler/numpy_interaction_test.py similarity index 100% rename from typed_python/compiler/tests/numpy_interaction_test.py rename to tests/compiler/numpy_interaction_test.py diff --git a/typed_python/compiler/tests/one_of_compilation_test.py b/tests/compiler/one_of_compilation_test.py similarity index 100% rename from typed_python/compiler/tests/one_of_compilation_test.py rename to tests/compiler/one_of_compilation_test.py diff --git a/typed_python/compiler/tests/operator_is_compilation_test.py b/tests/compiler/operator_is_compilation_test.py similarity index 100% rename from typed_python/compiler/tests/operator_is_compilation_test.py rename to tests/compiler/operator_is_compilation_test.py diff --git a/typed_python/compiler/tests/pointer_to_compilation_test.py b/tests/compiler/pointer_to_compilation_test.py similarity index 100% rename from typed_python/compiler/tests/pointer_to_compilation_test.py rename to tests/compiler/pointer_to_compilation_test.py diff --git a/typed_python/compiler/python_ast_analysis_test.py b/tests/compiler/python_ast_analysis_test.py similarity index 100% rename from typed_python/compiler/python_ast_analysis_test.py rename to tests/compiler/python_ast_analysis_test.py diff --git a/typed_python/compiler/tests/python_object_of_type_compilation_test.py b/tests/compiler/python_object_of_type_compilation_test.py similarity index 100% rename from typed_python/compiler/tests/python_object_of_type_compilation_test.py rename to tests/compiler/python_object_of_type_compilation_test.py diff --git a/typed_python/compiler/tests/range_compilation_test.py b/tests/compiler/range_compilation_test.py similarity index 100% rename from typed_python/compiler/tests/range_compilation_test.py rename to tests/compiler/range_compilation_test.py diff --git a/typed_python/compiler/tests/serialization_compilation_test.py b/tests/compiler/serialization_compilation_test.py similarity index 100% rename from typed_python/compiler/tests/serialization_compilation_test.py rename to tests/compiler/serialization_compilation_test.py diff --git a/typed_python/compiler/tests/set_compilation_test.py b/tests/compiler/set_compilation_test.py similarity index 100% rename from typed_python/compiler/tests/set_compilation_test.py rename to tests/compiler/set_compilation_test.py diff --git a/typed_python/compiler/tests/string_compilation_test.py b/tests/compiler/string_compilation_test.py similarity index 100% rename from typed_python/compiler/tests/string_compilation_test.py rename to tests/compiler/string_compilation_test.py diff --git a/typed_python/compiler/tests/subclass_of_test.py b/tests/compiler/subclass_of_test.py similarity index 100% rename from typed_python/compiler/tests/subclass_of_test.py rename to tests/compiler/subclass_of_test.py diff --git a/typed_python/compiler/tests/time_compilation_test.py b/tests/compiler/time_compilation_test.py similarity index 100% rename from typed_python/compiler/tests/time_compilation_test.py rename to tests/compiler/time_compilation_test.py diff --git a/typed_python/compiler/tests/tuple_compilation_test.py b/tests/compiler/tuple_compilation_test.py similarity index 100% rename from typed_python/compiler/tests/tuple_compilation_test.py rename to tests/compiler/tuple_compilation_test.py diff --git a/typed_python/compiler/tests/tuple_of_compilation_test.py b/tests/compiler/tuple_of_compilation_test.py similarity index 100% rename from typed_python/compiler/tests/tuple_of_compilation_test.py rename to tests/compiler/tuple_of_compilation_test.py diff --git a/typed_python/compiler/tests/type_conversion_test.py b/tests/compiler/type_conversion_test.py similarity index 100% rename from typed_python/compiler/tests/type_conversion_test.py rename to tests/compiler/type_conversion_test.py diff --git a/typed_python/compiler/tests/type_function_compilation_test.py b/tests/compiler/type_function_compilation_test.py similarity index 100% rename from typed_python/compiler/tests/type_function_compilation_test.py rename to tests/compiler/type_function_compilation_test.py diff --git a/typed_python/compiler/tests/type_inference_test.py b/tests/compiler/type_inference_test.py similarity index 100% rename from typed_python/compiler/tests/type_inference_test.py rename to tests/compiler/type_inference_test.py diff --git a/typed_python/compiler/tests/type_of_instances_compilation_test.py b/tests/compiler/type_of_instances_compilation_test.py similarity index 100% rename from typed_python/compiler/tests/type_of_instances_compilation_test.py rename to tests/compiler/type_of_instances_compilation_test.py diff --git a/typed_python/compiler/tests/typed_function_compilation_test.py b/tests/compiler/typed_function_compilation_test.py similarity index 100% rename from typed_python/compiler/tests/typed_function_compilation_test.py rename to tests/compiler/typed_function_compilation_test.py diff --git a/typed_python/lib/datetime/date_formatter_test.py b/tests/date_formatter_test.py similarity index 100% rename from typed_python/lib/datetime/date_formatter_test.py rename to tests/date_formatter_test.py diff --git a/typed_python/lib/datetime/date_parser_test.py b/tests/date_parser_test.py similarity index 100% rename from typed_python/lib/datetime/date_parser_test.py rename to tests/date_parser_test.py diff --git a/typed_python/lib/datetime/date_time_test.py b/tests/date_time_test.py similarity index 99% rename from typed_python/lib/datetime/date_time_test.py rename to tests/date_time_test.py index 1f14deb99..5aadc4151 100644 --- a/typed_python/lib/datetime/date_time_test.py +++ b/tests/date_time_test.py @@ -16,7 +16,7 @@ OneFoldOnlyError, PytzTimezone, ) -from typed_python.lib.datetime.date_parser_test import get_datetimes_in_range +from date_parser_test import get_datetimes_in_range from typed_python.lib.timestamp import Timestamp diff --git a/typed_python/lib/datetime/date_time_util_test.py b/tests/date_time_util_test.py similarity index 100% rename from typed_python/lib/datetime/date_time_util_test.py rename to tests/date_time_util_test.py diff --git a/typed_python/deep_bytecount_test.py b/tests/deep_bytecount_test.py similarity index 100% rename from typed_python/deep_bytecount_test.py rename to tests/deep_bytecount_test.py diff --git a/typed_python/deepcopy_test.py b/tests/deepcopy_test.py similarity index 100% rename from typed_python/deepcopy_test.py rename to tests/deepcopy_test.py diff --git a/typed_python/forward_types_test.py b/tests/forward_types_test.py similarity index 100% rename from typed_python/forward_types_test.py rename to tests/forward_types_test.py diff --git a/typed_python/function_signature_test.py b/tests/function_signature_test.py similarity index 100% rename from typed_python/function_signature_test.py rename to tests/function_signature_test.py diff --git a/typed_python/function_types_test.py b/tests/function_types_test.py similarity index 100% rename from typed_python/function_types_test.py rename to tests/function_types_test.py diff --git a/typed_python/macro_test.py b/tests/macro_test.py similarity index 100% rename from typed_python/macro_test.py rename to tests/macro_test.py diff --git a/typed_python/lib/map_test.py b/tests/map_test.py similarity index 100% rename from typed_python/lib/map_test.py rename to tests/map_test.py diff --git a/typed_python/module_representation_test.py b/tests/module_representation_test.py similarity index 100% rename from typed_python/module_representation_test.py rename to tests/module_representation_test.py diff --git a/typed_python/module_test.py b/tests/module_test.py similarity index 100% rename from typed_python/module_test.py rename to tests/module_test.py diff --git a/typed_python/lib/pmap_test.py b/tests/pmap_test.py similarity index 100% rename from typed_python/lib/pmap_test.py rename to tests/pmap_test.py diff --git a/typed_python/python_ast_test.py b/tests/python_ast_test.py similarity index 100% rename from typed_python/python_ast_test.py rename to tests/python_ast_test.py diff --git a/typed_python/lib/reduce_test.py b/tests/reduce_test.py similarity index 100% rename from typed_python/lib/reduce_test.py rename to tests/reduce_test.py diff --git a/typed_python/lib/sorted_dict_test.py b/tests/sorted_dict_test.py similarity index 100% rename from typed_python/lib/sorted_dict_test.py rename to tests/sorted_dict_test.py diff --git a/typed_python/lib/sorting_test.py b/tests/sorting_test.py similarity index 100% rename from typed_python/lib/sorting_test.py rename to tests/sorting_test.py diff --git a/typed_python/lib/timestamp_test.py b/tests/timestamp_test.py similarity index 100% rename from typed_python/lib/timestamp_test.py rename to tests/timestamp_test.py diff --git a/typed_python/type_function_test.py b/tests/type_function_test.py similarity index 99% rename from typed_python/type_function_test.py rename to tests/type_function_test.py index 47d740174..11ac07352 100644 --- a/typed_python/type_function_test.py +++ b/tests/type_function_test.py @@ -98,7 +98,7 @@ def List(T): def test_name_and_qualname(self): assert TfLevelMethod.__name__ == 'TfLevelMethod' - assert TfLevelMethod.__module__ == 'typed_python.type_function_test' + assert TfLevelMethod.__module__ == 'type_function_test' assert TfLevelMethod.__qualname__ == 'TfLevelMethod' def test_mutually_recursive(self): diff --git a/typed_python/type_identity_test.py b/tests/type_identity_test.py similarity index 99% rename from typed_python/type_identity_test.py rename to tests/type_identity_test.py index d32bb736e..09c42b0e8 100644 --- a/typed_python/type_identity_test.py +++ b/tests/type_identity_test.py @@ -60,7 +60,7 @@ def looksAtFilename(): def looksAtFilename2(): - return typed_python.type_identity_test.__file__ + return __file__ def checkHash(filesToWrite, expression): @@ -273,7 +273,8 @@ def test_mutually_recursive_group_basic(): X = Forward("X") X = X.define(TupleOf(OneOf(int, X))) - assert recursiveTypeGroup(X) == [X, OneOf(int, X)] + assert (recursiveTypeGroup(X) == [X, OneOf(int, X)] or + recursiveTypeGroup(X) == [OneOf(int, X), X]) # order-independent def test_mutually_recursive_group_through_functions_in_closure(): diff --git a/typed_python/typed_queue_test.py b/tests/typed_queue_test.py similarity index 100% rename from typed_python/typed_queue_test.py rename to tests/typed_queue_test.py diff --git a/typed_python/types_metadata_test.py b/tests/types_metadata_test.py similarity index 100% rename from typed_python/types_metadata_test.py rename to tests/types_metadata_test.py diff --git a/typed_python/types_named_tuple_test.py b/tests/types_named_tuple_test.py similarity index 100% rename from typed_python/types_named_tuple_test.py rename to tests/types_named_tuple_test.py diff --git a/typed_python/types_serialization_format_test.py b/tests/types_serialization_format_test.py similarity index 100% rename from typed_python/types_serialization_format_test.py rename to tests/types_serialization_format_test.py diff --git a/typed_python/types_serialization_test.py b/tests/types_serialization_test.py similarity index 95% rename from typed_python/types_serialization_test.py rename to tests/types_serialization_test.py index c5f33c2a1..d771b8906 100644 --- a/typed_python/types_serialization_test.py +++ b/tests/types_serialization_test.py @@ -1843,7 +1843,7 @@ def test_serialize_mutually_recursive_unnamed_forwards_tuples(self): def test_serialize_named_alternative(self): self.assertEqual( ModuleLevelAlternative.__module__, - "typed_python.types_serialization_test" + "types_serialization_test" ) sc = SerializationContext() @@ -1866,14 +1866,14 @@ def test_serialize_unnamed_recursive_alternative(self): ) def test_serialize_module_level_class(self): - assert ModuleLevelClass.__module__ == 'typed_python.types_serialization_test' + assert ModuleLevelClass.__module__ == 'types_serialization_test' sc = SerializationContext().withoutCompression() self.assertIs(sc.deserialize(sc.serialize(ModuleLevelClass)), ModuleLevelClass) self.assertIn( - b'typed_python.types_serialization_test.ModuleLevelClass', + b'types_serialization_test.ModuleLevelClass', sc.serialize(ModuleLevelClass), ) @@ -1899,7 +1899,7 @@ def test_serialize_named_subclass_of_named_tuple(self): self.assertEqual( ModuleLevelNamedTupleSubclass.__module__, - "typed_python.types_serialization_test" + "types_serialization_test" ) self.assertEqual( @@ -2031,7 +2031,7 @@ def f(): def getCellType(): return type(f.__closure__[0]) - assert callFunctionInFreshProcess(getCellType, ()) is getCellType() + assert callFunctionInFreshProcess(getCellType, (), extraEnvs={'PYTHONPATH': os.path.dirname(__file__)}) is getCellType() def test_self_visible_base_class_forward_resolved(self): Base = Forward("Base") @@ -2060,7 +2060,7 @@ def __add__(self, other: Base) -> Base: return Base, Child - Base, Child = callFunctionInFreshProcess(getOptimizer, ()) + Base, Child = callFunctionInFreshProcess(getOptimizer, (), extraEnvs={'PYTHONPATH': os.path.dirname(__file__)}) assert isinstance(Base() + Base() + Base(), Base) assert isinstance(Base() + Base() + Base(), Child) @@ -2082,7 +2082,7 @@ def g(self): return C_ - c = callFunctionInFreshProcess(C(int), ()) + c = callFunctionInFreshProcess(C(int), (), extraEnvs={'PYTHONPATH': os.path.dirname(__file__)}) assert c.g() == 10 assert c.s() is type(c) @@ -2106,7 +2106,7 @@ def g(self): return C_ - c = callFunctionInFreshProcess(C(int), ()) + c = callFunctionInFreshProcess(C(int), (), extraEnvs={'PYTHONPATH': os.path.dirname(__file__)}) assert c.g() == 10 assert c.s() is type(c) @@ -2175,7 +2175,10 @@ def makeLenProxyWeirdGlobals(): assert lenProxy("asdf") == 4 assert lenProxyWithNonstandardGlobals("asdf") == 4 - lenProxyDeserialized = callFunctionInFreshProcess(makeLenProxyWeirdGlobals, ()) + lenProxyDeserialized = callFunctionInFreshProcess(makeLenProxyWeirdGlobals, + (), + extraEnvs={'PYTHONPATH': os.path.dirname(__file__)} + ) assert lenProxyDeserialized("asdf") == 4 @@ -2225,7 +2228,7 @@ def seeItself(self, a, b, c, d): return SeesItself - SeesItself = callFunctionInFreshProcess(makeSeesItself, ()) + SeesItself = callFunctionInFreshProcess(makeSeesItself, (), extraEnvs={'PYTHONPATH': os.path.dirname(__file__)}) assert SeesItself.seeItself(1, 2, 3, 4, 5) is SeesItself @@ -2275,7 +2278,7 @@ class Cls: def f(self): return Cls - assert callFunctionInFreshProcess(Cls().f, ()) is Cls + assert callFunctionInFreshProcess(Cls().f, (), extraEnvs={'PYTHONPATH': os.path.dirname(__file__)}) is Cls def test_serialization_preserves_forward_structure_in_classes(self): def getCls(): @@ -2289,7 +2292,7 @@ def f(self) -> Cls: return Cls - Cls = callFunctionInFreshProcess(getCls, (), showStdout=True) + Cls = callFunctionInFreshProcess(getCls, (), showStdout=True, extraEnvs={'PYTHONPATH': os.path.dirname(__file__)}) assert Cls.f.__annotations__['return'].__typed_python_category__ == 'Forward' Cls2 = getCls() @@ -2304,7 +2307,7 @@ class Cls: def f(self) -> Cls: return "HI" - assert callFunctionInFreshProcess(Cls, ()).f() == "HI" + assert callFunctionInFreshProcess(Cls, (), extraEnvs={'PYTHONPATH': os.path.dirname(__file__)}).f() == "HI" def test_can_deserialize_untyped_forward_class_methods_2(self): def getCls(): @@ -2318,7 +2321,7 @@ def f(self) -> Cls: return Cls - callFunctionInFreshProcess(getCls, ()) + callFunctionInFreshProcess(getCls, (), extraEnvs={'PYTHONPATH': os.path.dirname(__file__)}) def test_can_deserialize_forward_class_methods_tp_class(self): Cls = Forward("Cls") @@ -2330,7 +2333,7 @@ class Cls(Class): def f(self) -> Cls: return Cls(m='HI') - assert callFunctionInFreshProcess(Cls, ()).f().m == "HI" + assert callFunctionInFreshProcess(Cls, (), extraEnvs={'PYTHONPATH': os.path.dirname(__file__)}).f().m == "HI" def test_can_deserialize_forward_class_methods_tp_class_no_self_reference(self): Cls = Forward("Cls") @@ -2342,7 +2345,7 @@ class Cls(Class): def f(self) -> str: return "HI" - assert callFunctionInFreshProcess(Cls, ()).f() == "HI" + assert callFunctionInFreshProcess(Cls, (), extraEnvs={'PYTHONPATH': os.path.dirname(__file__)}).f() == "HI" def test_deserialize_regular_class_retains_identity(self): class Cls: @@ -2351,7 +2354,7 @@ def f(self): Cls return "HI" - Cls2 = type(callFunctionInFreshProcess(Cls, ())) + Cls2 = type(callFunctionInFreshProcess(Cls, (), extraEnvs={'PYTHONPATH': os.path.dirname(__file__)})) assert identityHash(Cls).hex() == identityHash(Cls2).hex() @@ -2367,7 +2370,7 @@ def f(x: float): return (f, identityHash(f)) - f, identityHashOfF = callFunctionInFreshProcess(makeFunction, ()) + f, identityHashOfF = callFunctionInFreshProcess(makeFunction, (), extraEnvs={'PYTHONPATH': os.path.dirname(__file__)}) assert identityHash(f) == identityHashOfF @@ -2383,7 +2386,7 @@ def f(x=None): return (f, identityHash(f)) - f, identityHashOfF = callFunctionInFreshProcess(makeFunction, ()) + f, identityHashOfF = callFunctionInFreshProcess(makeFunction, (), extraEnvs={'PYTHONPATH': os.path.dirname(__file__)}) assert identityHash(f) == identityHashOfF @@ -2399,7 +2402,7 @@ class Cls: def f(self) -> Cls: return Cls() - Cls2 = type(callFunctionInFreshProcess(Cls, ())) + Cls2 = type(callFunctionInFreshProcess(Cls, (), extraEnvs={'PYTHONPATH': os.path.dirname(__file__)})) l = recursiveTypeGroupDeepRepr(Cls).split("\n") r = recursiveTypeGroupDeepRepr(Cls2).split("\n") @@ -2429,7 +2432,7 @@ class Cls(Class): def f(self) -> Cls: return Cls() - Cls2 = type(callFunctionInFreshProcess(Cls, ())) + Cls2 = type(callFunctionInFreshProcess(Cls, (), extraEnvs={'PYTHONPATH': os.path.dirname(__file__)})) assert identityHash(Cls) == identityHash(Cls2) @@ -2468,7 +2471,7 @@ def callF(x): else: return "FAILED" - assert callFunctionInFreshProcess(deserializeAndCall, (aChildBytes,)) == "OK" + assert callFunctionInFreshProcess(deserializeAndCall, (aChildBytes,), extraEnvs={'PYTHONPATH': os.path.dirname(__file__)}) == "OK" def test_call_method_dispatch_on_two_versions_of_self_referential_class_produced_differently(self): def deserializeAndCall(): @@ -2492,8 +2495,8 @@ def f(self, x) -> int: return Child(), callF - child1, callF1 = callFunctionInFreshProcess(deserializeAndCall, ()) - child2, callF2 = callFunctionInFreshProcess(deserializeAndCall, ()) + child1, callF1 = callFunctionInFreshProcess(deserializeAndCall, (), extraEnvs={'PYTHONPATH': os.path.dirname(__file__)}) + child2, callF2 = callFunctionInFreshProcess(deserializeAndCall, (), extraEnvs={'PYTHONPATH': os.path.dirname(__file__)}) assert identityHash(child1) == identityHash(child2) assert identityHash(callF1) == identityHash(callF2) @@ -2526,8 +2529,8 @@ def callF(x: Child): return Base, callF - Base1, callF1 = callFunctionInFreshProcess(deserializeAndCall, ()) - Base2, callF2 = callFunctionInFreshProcess(deserializeAndCall, ()) + Base1, callF1 = callFunctionInFreshProcess(deserializeAndCall, (), extraEnvs={'PYTHONPATH': os.path.dirname(__file__)}) + Base2, callF2 = callFunctionInFreshProcess(deserializeAndCall, (), extraEnvs={'PYTHONPATH': os.path.dirname(__file__)}) assert identityHash(Base1) == identityHash(Base2) assert identityHash(callF1) == identityHash(callF2) @@ -2578,7 +2581,7 @@ def f(self, x) -> int: return SerializationContext().serialize(Child()) - childBytes = callFunctionInFreshProcess(deserializeAndCall, ()) + childBytes = callFunctionInFreshProcess(deserializeAndCall, (), extraEnvs={'PYTHONPATH': os.path.dirname(__file__)}) child1 = SerializationContext().deserialize(childBytes) child2 = SerializationContext().deserialize(childBytes) @@ -2606,7 +2609,7 @@ def aFun(): return s.serialize(aFun) - childBytes = callFunctionInFreshProcess(returnSerializedForm, ()) + childBytes = callFunctionInFreshProcess(returnSerializedForm, (), extraEnvs={'PYTHONPATH': os.path.dirname(__file__)}) childFun = ( SerializationContext() @@ -2657,7 +2660,9 @@ def f(self): return (BaseClass, ChildClass, ChildClass()) - BaseClass, ChildClass, childInstance = callFunctionInFreshProcess(makeClasses, ()) + BaseClass, ChildClass, childInstance = callFunctionInFreshProcess(makeClasses, + (), + extraEnvs={'PYTHONPATH': os.path.dirname(__file__)}) assert type(BaseClass) is ABCMeta @@ -2695,7 +2700,7 @@ class ChildClass(BaseClass): return (BaseClass, ChildClass, recursiveTypeGroupDeepRepr(BaseClass)) - BaseClass, ChildClass, deepRepr = callFunctionInFreshProcess(makeClasses, ()) + BaseClass, ChildClass, deepRepr = callFunctionInFreshProcess(makeClasses, (), extraEnvs={'PYTHONPATH': os.path.dirname(__file__)}) assert type(BaseClass.getChild()) is ChildClass @@ -2714,7 +2719,7 @@ def makeF(): return f - f = callFunctionInFreshProcess(makeF, ()) + f = callFunctionInFreshProcess(makeF, (), extraEnvs={'PYTHONPATH': os.path.dirname(__file__)}) assert f(10) == 10 @@ -2737,7 +2742,7 @@ class Child(Base): return s.serialize(Child) Child2 = SerializationContext().deserialize( - callFunctionInFreshProcess(serializeIt, ()) + callFunctionInFreshProcess(serializeIt, (), extraEnvs={'PYTHONPATH': os.path.dirname(__file__)}) ) assert Child2().func() == 10 @@ -2776,7 +2781,7 @@ def makeF(): s = SerializationContext() return s.serialize(globals['anF']) - serializedF = callFunctionInFreshProcess(makeF, ()) + serializedF = callFunctionInFreshProcess(makeF, (), extraEnvs={'PYTHONPATH': os.path.dirname(__file__)}) f = SerializationContext().deserialize(serializedF) @@ -2813,7 +2818,7 @@ def makeC(): s = SerializationContext() return s.serialize(globals['C']) - serializedC = callFunctionInFreshProcess(makeC, ()) + serializedC = callFunctionInFreshProcess(makeC, (), extraEnvs={'PYTHONPATH': os.path.dirname(__file__)}) C = SerializationContext().deserialize(serializedC) @@ -2847,7 +2852,7 @@ def makeC(): s = SerializationContext() return s.serialize(globals['C']) - serializedC = callFunctionInFreshProcess(makeC, ()) + serializedC = callFunctionInFreshProcess(makeC, (), extraEnvs={'PYTHONPATH': os.path.dirname(__file__)}) C = SerializationContext().deserialize(serializedC) @@ -2887,8 +2892,12 @@ def makeF(modulename): s = SerializationContext() return s.serialize(globals['f']) - f1 = SerializationContext().deserialize(callFunctionInFreshProcess(makeF, ('asdf',))) - f2 = SerializationContext().deserialize(callFunctionInFreshProcess(makeF, ('asdf2',))) + f1 = SerializationContext().deserialize(callFunctionInFreshProcess(makeF, + ('asdf',), + extraEnvs={'PYTHONPATH': os.path.dirname(__file__)})) + f2 = SerializationContext().deserialize(callFunctionInFreshProcess(makeF, + ('asdf2',), + extraEnvs={'PYTHONPATH': os.path.dirname(__file__)})) def checkSame(f1, f2): s = SerializationContext().withoutCompression() @@ -3023,15 +3032,14 @@ def makeC(): globals = {'__file__': path} - exec( - compile(CONTENTS, path, "exec"), - globals - ) + exec(compile(CONTENTS, path, "exec"), + globals + ) s = SerializationContext() return s.serialize(globals['f']) - serializedF = callFunctionInFreshProcess(makeC, ()) + serializedF = callFunctionInFreshProcess(makeC, (), extraEnvs={'PYTHONPATH': os.path.dirname(__file__)}) f = SerializationContext().deserialize(serializedF) @@ -3056,7 +3064,7 @@ def f(self): return x - x = callFunctionInFreshProcess(getX, (), showStdout=True) + x = callFunctionInFreshProcess(getX, (), showStdout=True, extraEnvs={'PYTHONPATH': os.path.dirname(__file__)}) print(x) # TODO: make this True diff --git a/typed_python/types_test.py b/tests/types_test.py similarity index 99% rename from typed_python/types_test.py rename to tests/types_test.py index 721c62b86..75e746807 100644 --- a/typed_python/types_test.py +++ b/tests/types_test.py @@ -185,8 +185,8 @@ def pickRandomly(self): class TypesTests(unittest.TestCase): def test_alternative_module(self): - assert AnAlternative.__module__ == 'typed_python.types_test' - assert AForwardAlternative.__module__ == 'typed_python.types_test' + assert AnAlternative.__module__ == 'types_test' + assert AForwardAlternative.__module__ == 'types_test' def test_refcount_bug_with_simple_string(self): with self.assertRaisesRegex(TypeError, "first argument to refcount '111' not a permitted Type"): diff --git a/tox.ini b/tox.ini index 25734eeb5..cfd6cb88f 100644 --- a/tox.ini +++ b/tox.ini @@ -14,7 +14,7 @@ commands = [pytest] testpaths = - typed_python + tests log_level = INFO log_format = [%(asctime)s.%(msecs)03d] %(levelname)8s %(filename)30s:%(lineno)4s | %(threadName)10s | %(message)s