Skip to content

Commit

Permalink
Run unit tests without affecting user browser session (#6333)
Browse files Browse the repository at this point in the history
Exercise the `open_in_browser` argument from the
test_generate_html_file_with_browser test, but do
not affect the actual browser session.
  • Loading branch information
pavoljuhas committed Nov 1, 2023
1 parent fec68ae commit 5485227
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cirq-web/cirq_web/widget_test.py
Expand Up @@ -12,7 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import os
from pathlib import Path
from unittest import mock

import cirq_web


Expand Down Expand Up @@ -50,6 +53,7 @@ def test_repr_html(tmpdir):
assert remove_whitespace(expected) == remove_whitespace(actual)


@mock.patch.dict(os.environ, {"BROWSER": "true"})
def test_generate_html_file_with_browser(tmpdir):
# # Reset the path so the files are accessible
cirq_web.widget._DIST_PATH = Path(tmpdir) / "dir"
Expand Down

0 comments on commit 5485227

Please sign in to comment.