Skip to content

Commit eb51ddc

Browse files
authored
Let all sub-packages indicate when testing is in progress (#7174)
Problem: Deprecation helpers in `cirq._compat` need to detect if they are used in a test session, but that did not work in some sub-packages. Solution: Make every cirq-subpackage set `CIRQ_TESTING`.
1 parent 3d6227f commit eb51ddc

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright 2025 The Cirq Developers
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import os
16+
17+
18+
def pytest_configure(config):
19+
os.environ['CIRQ_TESTING'] = "true"

cirq-rigetti/cirq_rigetti/conftest.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import os
1516
from typing import (
1617
Any,
1718
Iterable,
@@ -49,6 +50,10 @@
4950
T = TypeVar("T")
5051

5152

53+
def pytest_configure(config):
54+
os.environ['CIRQ_TESTING'] = "true"
55+
56+
5257
class MockQAM(QAM, Generic[T]):
5358
_run_count: int
5459
_mock_results: Dict[str, np.ndarray]

cirq-web/cirq_web/conftest.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright 2025 The Cirq Developers
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import os
16+
17+
18+
def pytest_configure(config):
19+
os.environ['CIRQ_TESTING'] = "true"

0 commit comments

Comments
 (0)