From 2a10af39c8b2b84f6856752331d3f6e868ac5b8e Mon Sep 17 00:00:00 2001 From: Ryan Beisner Date: Thu, 1 Nov 2018 21:57:18 -0500 Subject: [PATCH] Fix lint in unit tests re: py3-first and py2 compat Change-Id: I22d359df04f613c9a3306b8eae5ab9298acc9120 --- .stestr.conf | 3 +++ unit_tests/__init__.py | 1 + unit_tests/test_utils.py | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 .stestr.conf diff --git a/.stestr.conf b/.stestr.conf new file mode 100644 index 00000000..5fcccaca --- /dev/null +++ b/.stestr.conf @@ -0,0 +1,3 @@ +[DEFAULT] +test_path=./unit_tests +top_dir=./ diff --git a/unit_tests/__init__.py b/unit_tests/__init__.py index bbd23dfc..cc0b3b71 100644 --- a/unit_tests/__init__.py +++ b/unit_tests/__init__.py @@ -24,5 +24,6 @@ def _add_path(path): if path not in sys.path: sys.path.insert(1, path) + _add_path(_actions) _add_path(_hooks) diff --git a/unit_tests/test_utils.py b/unit_tests/test_utils.py index 278ce805..f9b7b82c 100644 --- a/unit_tests/test_utils.py +++ b/unit_tests/test_utils.py @@ -150,7 +150,7 @@ def patch_open(): Yields the mock for "open" and "file", respectively.''' mock_open = MagicMock(spec=open) - mock_file = MagicMock(spec=file) + mock_file = MagicMock(spec=__file__) @contextmanager def stub_open(*args, **kwargs):