Skip to content

Commit 5485227

Browse files
authored
Run unit tests without affecting user browser session (#6333)
Exercise the `open_in_browser` argument from the test_generate_html_file_with_browser test, but do not affect the actual browser session.
1 parent fec68ae commit 5485227

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

cirq-web/cirq_web/widget_test.py

+4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import os
1516
from pathlib import Path
17+
from unittest import mock
18+
1619
import cirq_web
1720

1821

@@ -50,6 +53,7 @@ def test_repr_html(tmpdir):
5053
assert remove_whitespace(expected) == remove_whitespace(actual)
5154

5255

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

0 commit comments

Comments
 (0)