-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix _compat tests #4926
Fix _compat tests #4926
Conversation
Oh wait not quite fixed correctly yet. |
The functions were supposed to run in a subprocess so they do their imports in isolation. BTW, I also saw a missing import error, please add diff --git a/cirq-core/cirq/_compat_test.py b/cirq-core/cirq/_compat_test.py
index 1dd95bb2..28dfb6dd 100644
--- a/cirq-core/cirq/_compat_test.py
+++ b/cirq-core/cirq/_compat_test.py
@@ -798,6 +798,8 @@ def _test_broken_module_2_inner():
def _test_broken_module_3_inner():
+ import cirq.testing._compat_test_data
+
with cirq.testing.assert_deprecated(deadline="v0.20", count=None):
with pytest.raises(
DeprecatedModuleImportError, |
OK, yeah patched things up. Yeah these tests were no-ops, so nice to fix. |
Also added an assert to make sure none of the other cases were failing in this manner. |
Ah now windows tests are failing. Joy. |
Tests may be failing on Windows because they use Cirq/cirq-core/cirq/_compat_test.py Line 603 in 4f354ea
This seems to get fixed after explicitly activating Python warnings in the failing tests. diff --git a/cirq-core/cirq/_compat_test.py b/cirq-core/cirq/_compat_test.py
index 28dfb6dd..e6ab64e3 100644
--- a/cirq-core/cirq/_compat_test.py
+++ b/cirq-core/cirq/_compat_test.py
@@ -667,7 +667,6 @@ def _test_deprecated_module_inner(outdated_method, deprecation_messages):
deadline='v0.20',
count=len(deprecation_messages),
):
- import warnings
warnings.simplefilter('always')
outdated_method()
@@ -785,6 +784,7 @@ def _test_broken_module_1_inner():
def _test_broken_module_2_inner():
+ warnings.simplefilter('always')
with cirq.testing.assert_deprecated(deadline="v0.20", count=None):
with pytest.raises(
DeprecatedModuleImportError,
@@ -800,6 +800,7 @@ def _test_broken_module_2_inner():
def _test_broken_module_3_inner():
import cirq.testing._compat_test_data
+ warnings.simplefilter('always')
with cirq.testing.assert_deprecated(deadline="v0.20", count=None):
with pytest.raises(
DeprecatedModuleImportError, |
@pavoljuhas thanks for figuring that out. Windows always does spawn, which I guess resets the warning, so I think your fix fixes things. |
Fixes some of the out of order test breakage described in quantumlib#4921 These tests are certainly broken, they are supposed to pass in the function not the result of the function. Not sure I fully see why this interacts badly with test_deprecated_module tests, but once it hits one of these failing the following parameterized tests fail.
Fixes some of the out of order test breakage described in quantumlib#4921 These tests are certainly broken, they are supposed to pass in the function not the result of the function. Not sure I fully see why this interacts badly with test_deprecated_module tests, but once it hits one of these failing the following parameterized tests fail.
Fixes some of the out of order test breakage described in #4921
These tests are certainly broken, they are supposed to pass in the function not the result of the function.
Not sure I fully see why this interacts badly with test_deprecated_module tests, but once it hits one of these failing the following parameterized tests fail.