diff --git a/CHANGELOG.md b/CHANGELOG.md index c92c3ea6d64..a5fe864cc10 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). ## Unreleased ### Fixed +- Fix the test suite leaving `numpy` removed from `sys.modules` after `test_no_numpy_int_type` runs, which broke any later test importing `numpy` in the same pytest process [[#4852](https://github.com/plotly/plotly.py/issues/4852)] - Fix `mpl_to_plotly` tick marker mirroring, axis positioning, and trace visibility for twinned and overlaid subplots (such as `twinx` and `twiny`) [[#5310](https://github.com/plotly/plotly.py/pull/5310)], with thanks to @robertoffmoura for the contribution! - Fix `mpl_to_plotly` losing matplotlib axis line colors by exporting the color of each axis's displayed spine to the plotly x and y axis `linecolor` [[#5311](https://github.com/plotly/plotly.py/pull/5311)], with thanks to @robertoffmoura for the contribution! - Fix concurrent first access to lazily initialized graph object properties, which could raise `ValueError("Invalid value")` [[#5691](https://github.com/plotly/plotly.py/pull/5691)], with thanks to @hb1915 for the contribution! diff --git a/tests/test_optional/test_utils/test_utils.py b/tests/test_optional/test_utils/test_utils.py index d3f2a4be160..b7091c3356d 100644 --- a/tests/test_optional/test_utils/test_utils.py +++ b/tests/test_optional/test_utils/test_utils.py @@ -491,10 +491,15 @@ def test_no_numpy_int_type(self): from _plotly_utils.optional_imports import get_module np = get_module("numpy", should_load=False) + saved_numpy = None if np: - sys.modules.pop("numpy") + saved_numpy = sys.modules.pop("numpy") - int_type_tuple = _get_int_type() - expected_tuple = (int,) + try: + int_type_tuple = _get_int_type() + expected_tuple = (int,) - self.assertEqual(int_type_tuple, expected_tuple) + self.assertEqual(int_type_tuple, expected_tuple) + finally: + if saved_numpy is not None: + sys.modules["numpy"] = saved_numpy