|
31 | 31 | _get_installed_modules, |
32 | 32 | _generate_installed_modules, |
33 | 33 | ensure_integration_enabled, |
34 | | - ensure_integration_enabled_async, |
35 | 34 | ) |
36 | 35 |
|
37 | 36 |
|
38 | 37 | class TestIntegration(Integration): |
39 | 38 | """ |
40 | | - Test integration for testing ensure_integration_enabled and |
41 | | - ensure_integration_enabled_async decorators. |
| 39 | + Test integration for testing ensure_integration_enabled decorator. |
42 | 40 | """ |
43 | 41 |
|
44 | 42 | identifier = "test" |
@@ -783,90 +781,6 @@ def function_to_patch(): |
783 | 781 | assert patched_function.__name__ == "function_to_patch" |
784 | 782 |
|
785 | 783 |
|
786 | | -@pytest.mark.asyncio |
787 | | -async def test_ensure_integration_enabled_async_integration_enabled(sentry_init): |
788 | | - # Setup variables and functions for the test |
789 | | - async def original_function(): |
790 | | - return "original" |
791 | | - |
792 | | - async def function_to_patch(): |
793 | | - return "patched" |
794 | | - |
795 | | - sentry_init(integrations=[TestIntegration()]) |
796 | | - |
797 | | - # Test the decorator by applying to function_to_patch |
798 | | - patched_function = ensure_integration_enabled_async( |
799 | | - TestIntegration, original_function |
800 | | - )(function_to_patch) |
801 | | - |
802 | | - assert await patched_function() == "patched" |
803 | | - assert patched_function.__name__ == "original_function" |
804 | | - |
805 | | - |
806 | | -@pytest.mark.asyncio |
807 | | -async def test_ensure_integration_enabled_async_integration_disabled(sentry_init): |
808 | | - # Setup variables and functions for the test |
809 | | - async def original_function(): |
810 | | - return "original" |
811 | | - |
812 | | - async def function_to_patch(): |
813 | | - return "patched" |
814 | | - |
815 | | - sentry_init(integrations=[]) # TestIntegration is disabled |
816 | | - |
817 | | - # Test the decorator by applying to function_to_patch |
818 | | - patched_function = ensure_integration_enabled_async( |
819 | | - TestIntegration, original_function |
820 | | - )(function_to_patch) |
821 | | - |
822 | | - assert await patched_function() == "original" |
823 | | - assert patched_function.__name__ == "original_function" |
824 | | - |
825 | | - |
826 | | -@pytest.mark.asyncio |
827 | | -async def test_ensure_integration_enabled_async_no_original_function_enabled( |
828 | | - sentry_init, |
829 | | -): |
830 | | - shared_variable = "original" |
831 | | - |
832 | | - async def function_to_patch(): |
833 | | - nonlocal shared_variable |
834 | | - shared_variable = "patched" |
835 | | - |
836 | | - sentry_init(integrations=[TestIntegration]) |
837 | | - |
838 | | - # Test the decorator by applying to function_to_patch |
839 | | - patched_function = ensure_integration_enabled_async(TestIntegration)( |
840 | | - function_to_patch |
841 | | - ) |
842 | | - await patched_function() |
843 | | - |
844 | | - assert shared_variable == "patched" |
845 | | - assert patched_function.__name__ == "function_to_patch" |
846 | | - |
847 | | - |
848 | | -@pytest.mark.asyncio |
849 | | -async def test_ensure_integration_enabled_async_no_original_function_disabled( |
850 | | - sentry_init, |
851 | | -): |
852 | | - shared_variable = "original" |
853 | | - |
854 | | - async def function_to_patch(): |
855 | | - nonlocal shared_variable |
856 | | - shared_variable = "patched" |
857 | | - |
858 | | - sentry_init(integrations=[]) |
859 | | - |
860 | | - # Test the decorator by applying to function_to_patch |
861 | | - patched_function = ensure_integration_enabled_async(TestIntegration)( |
862 | | - function_to_patch |
863 | | - ) |
864 | | - await patched_function() |
865 | | - |
866 | | - assert shared_variable == "original" |
867 | | - assert patched_function.__name__ == "function_to_patch" |
868 | | - |
869 | | - |
870 | 784 | @pytest.mark.parametrize( |
871 | 785 | "delta,expected_milliseconds", |
872 | 786 | [ |
|
0 commit comments