Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Some of the cirq-XXX modules were lacking the dependency on cirq-core. This PR adds tests in isolation for each of the modules where they are installed and pytested in a clean environment. Fixes #4361.
- Loading branch information
Showing
23 changed files
with
258 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
requests~=2.18 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
requests~=2.18 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Copyright 2020 The Cirq Developers | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
"""Tests the cloned_env fixture in conftest.py""" | ||
import json | ||
import os | ||
from unittest import mock | ||
|
||
import pytest | ||
|
||
from dev_tools import shell_tools | ||
from dev_tools.test_utils import only_on_posix | ||
|
||
|
||
# due to shell_tools dependencies windows builds break on this | ||
# see https://github.com/quantumlib/Cirq/issues/4394 | ||
@only_on_posix | ||
# ensure that no cirq packages are on the PYTHONPATH, this is important, otherwise | ||
# the "isolation" fails and all the cirq modules would be in the list | ||
@mock.patch.dict(os.environ, {"PYTHONPATH": ""}) | ||
@pytest.mark.parametrize('param', ['a', 'b', 'c']) | ||
def test_isolated_env_cloning(cloned_env, param): | ||
env = cloned_env("test_isolated", "flynt==0.64") | ||
assert (env / "bin" / "pip").is_file() | ||
|
||
result = shell_tools.run_cmd( | ||
*f"{env}/bin/pip list --format=json".split(), out=shell_tools.TeeCapture() | ||
) | ||
packages = json.loads(result.out) | ||
assert {"name": "flynt", "version": "0.64"} in packages | ||
assert {"astor", "flynt", "pip", "setuptools", "wheel"} == set(p['name'] for p in packages) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.