.tox create: /tmp/tmp28z5lwb5/pytest-mpl-0.12/.tox/.tox .tox installdeps: setuptools >= 30.3.0, pip >= 19.3.1, tox >= 3.19.0 GLOB sdist-make: /tmp/tmp28z5lwb5/pytest-mpl-0.12/setup.py py38 create: /tmp/tmp28z5lwb5/pytest-mpl-0.12/.tox/py38 py38 inst: /tmp/tmp28z5lwb5/pytest-mpl-0.12/.tox/.tmp/package/1/pytest-mpl-0.12.zip py38 installed: attrs==20.3.0,coverage==5.3,cycler==0.10.0,iniconfig==1.1.1,kiwisolver==1.3.1,matplotlib==3.3.3,numpy==1.19.4,packaging==20.4,Pillow==8.0.1,pluggy==0.13.1,py==1.9.0,pyparsing==2.4.7,pytest==6.1.2,pytest-cov==2.10.1,pytest-mpl @ file:///tmp/tmp28z5lwb5/pytest-mpl-0.12/.tox/.tmp/package/1/pytest-mpl-0.12.zip,python-dateutil==2.8.1,six==1.15.0,toml==0.10.2 py38 run-test-pre: PYTHONHASHSEED='110932606' py38 run-test: commands[0] | pip freeze attrs==20.3.0 coverage==5.3 cycler==0.10.0 iniconfig==1.1.1 kiwisolver==1.3.1 matplotlib==3.3.3 numpy==1.19.4 packaging==20.4 Pillow==8.0.1 pluggy==0.13.1 py==1.9.0 pyparsing==2.4.7 pytest==6.1.2 pytest-cov==2.10.1 pytest-mpl @ file:///tmp/tmp28z5lwb5/pytest-mpl-0.12/.tox/.tmp/package/1/pytest-mpl-0.12.zip python-dateutil==2.8.1 six==1.15.0 toml==0.10.2 py38 run-test: commands[1] | pytest /tmp/tmp28z5lwb5/pytest-mpl-0.12 ============================= test session starts ============================== platform linux -- Python 3.8.0, pytest-6.1.2, py-1.9.0, pluggy-0.13.1 cachedir: .tox/py38/.pytest_cache Matplotlib: 3.3.3 Freetype: 2.6.1 rootdir: /tmp/tmp28z5lwb5/pytest-mpl-0.12, configfile: setup.cfg plugins: cov-2.10.1, mpl-0.12 collected 20 items ../../tests/test_pytest_mpl.py ................sFFF [100%] =================================== FAILURES =================================== _______________________________ test_hash_fails ________________________________ args = ['--mpl', '/tmp/pytest-of-travis/pytest-16/test_hash_fails0/test.py'] output_substring = "doesn't match hash FAIL in library" def assert_pytest_fails_with(args, output_substring): try: > subprocess.check_output([sys.executable, '-m', 'pytest', '-s'] + args) ../../tests/test_pytest_mpl.py:49: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ timeout = None popenargs = (['/tmp/tmp28z5lwb5/pytest-mpl-0.12/.tox/py38/bin/python', '-m', 'pytest', '-s', '--mpl', '/tmp/pytest-of-travis/pytest-16/test_hash_fails0/test.py'],) kwargs = {} def check_output(*popenargs, timeout=None, **kwargs): r"""Run command with arguments and return its output. If the exit code was non-zero it raises a CalledProcessError. The CalledProcessError object will have the return code in the returncode attribute and output in the output attribute. The arguments are the same as for the Popen constructor. Example: >>> check_output(["ls", "-l", "/dev/null"]) b'crw-rw-rw- 1 root root 1, 3 Oct 18 2007 /dev/null\n' The stdout argument is not allowed as it is used internally. To capture standard error in the result, use stderr=STDOUT. >>> check_output(["/bin/sh", "-c", ... "ls -l non_existent_file ; exit 0"], ... stderr=STDOUT) b'ls: non_existent_file: No such file or directory\n' There is an additional optional argument, "input", allowing you to pass a string to the subprocess's stdin. If you use this argument you may not also use the Popen constructor's "stdin" argument, as it too will be used internally. Example: >>> check_output(["sed", "-e", "s/foo/bar/"], ... input=b"when in the course of fooman events\n") b'when in the course of barman events\n' By default, all communication is in bytes, and therefore any "input" should be bytes, and the return value will be bytes. If in text mode, any "input" should be a string, and the return value will be a string decoded according to locale encoding, or by "encoding" if set. Text mode is triggered by setting any of text, encoding, errors or universal_newlines. """ if 'stdout' in kwargs: raise ValueError('stdout argument not allowed, it will be overridden.') if 'input' in kwargs and kwargs['input'] is None: # Explicitly passing input=None was previously equivalent to passing an # empty string. That is maintained here for backwards compatibility. kwargs['input'] = '' if kwargs.get('universal_newlines', False) else b'' > return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, **kwargs).stdout /opt/python/3.8.0/lib/python3.8/subprocess.py:411: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ input = None, capture_output = False, timeout = None, check = True popenargs = (['/tmp/tmp28z5lwb5/pytest-mpl-0.12/.tox/py38/bin/python', '-m', 'pytest', '-s', '--mpl', '/tmp/pytest-of-travis/pytest-16/test_hash_fails0/test.py'],) kwargs = {'stdout': -1}, process = stdout = b'============================= test session starts ==============================\nplatform linux -- Python 3.8.0, py...sh_fails0/test.py::test_hash_fails\n============================== 1 failed in 2.47s ===============================\n' stderr = None, retcode = 1 def run(*popenargs, input=None, capture_output=False, timeout=None, check=False, **kwargs): """Run command with arguments and return a CompletedProcess instance. The returned instance will have attributes args, returncode, stdout and stderr. By default, stdout and stderr are not captured, and those attributes will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them. If check is True and the exit code was non-zero, it raises a CalledProcessError. The CalledProcessError object will have the return code in the returncode attribute, and output & stderr attributes if those streams were captured. If timeout is given, and the process takes too long, a TimeoutExpired exception will be raised. There is an optional argument "input", allowing you to pass bytes or a string to the subprocess's stdin. If you use this argument you may not also use the Popen constructor's "stdin" argument, as it will be used internally. By default, all communication is in bytes, and therefore any "input" should be bytes, and the stdout and stderr will be bytes. If in text mode, any "input" should be a string, and stdout and stderr will be strings decoded according to locale encoding, or by "encoding" if set. Text mode is triggered by setting any of text, encoding, errors or universal_newlines. The other arguments are the same as for the Popen constructor. """ if input is not None: if kwargs.get('stdin') is not None: raise ValueError('stdin and input arguments may not both be used.') kwargs['stdin'] = PIPE if capture_output: if kwargs.get('stdout') is not None or kwargs.get('stderr') is not None: raise ValueError('stdout and stderr arguments may not be used ' 'with capture_output.') kwargs['stdout'] = PIPE kwargs['stderr'] = PIPE with Popen(*popenargs, **kwargs) as process: try: stdout, stderr = process.communicate(input, timeout=timeout) except TimeoutExpired as exc: process.kill() if _mswindows: # Windows accumulates the output in a single blocking # read() call run on child threads, with the timeout # being done in a join() on those threads. communicate() # _after_ kill() is required to collect that and add it # to the exception. exc.stdout, exc.stderr = process.communicate() else: # POSIX _communicate already populated the output so # far into the TimeoutExpired exception. process.wait() raise except: # Including KeyboardInterrupt, communicate handled that. process.kill() # We don't call process.wait() as .__exit__ does that for us. raise retcode = process.poll() if check and retcode: > raise CalledProcessError(retcode, process.args, output=stdout, stderr=stderr) E subprocess.CalledProcessError: Command '['/tmp/tmp28z5lwb5/pytest-mpl-0.12/.tox/py38/bin/python', '-m', 'pytest', '-s', '--mpl', '/tmp/pytest-of-travis/pytest-16/test_hash_fails0/test.py']' returned non-zero exit status 1. /opt/python/3.8.0/lib/python3.8/subprocess.py:512: CalledProcessError During handling of the above exception, another exception occurred: tmpdir = local('/tmp/pytest-of-travis/pytest-16/test_hash_fails0') def test_hash_fails(tmpdir): test_file = tmpdir.join('test.py').strpath with open(test_file, 'w', encoding='ascii') as f: f.write(TEST_FAILING_HASH) # If we use --mpl, it should detect that the figure is wrong > output = assert_pytest_fails_with(['--mpl', test_file], "doesn't match hash FAIL in library") ../../tests/test_pytest_mpl.py:290: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ args = ['--mpl', '/tmp/pytest-of-travis/pytest-16/test_hash_fails0/test.py'] output_substring = "doesn't match hash FAIL in library" def assert_pytest_fails_with(args, output_substring): try: subprocess.check_output([sys.executable, '-m', 'pytest', '-s'] + args) except subprocess.CalledProcessError as exc: output = exc.output.decode() > assert output_substring in output, output E AssertionError: ============================= test session starts ============================== E platform linux -- Python 3.8.0, pytest-6.1.2, py-1.9.0, pluggy-0.13.1 E cachedir: tmp28z5lwb5/pytest-mpl-0.12/.tox/py38/.pytest_cache E Matplotlib: 3.3.3 E Freetype: 2.6.1 E rootdir: /tmp E plugins: cov-2.10.1, mpl-0.12 E collected 1 item E E ../../../../pytest-of-travis/pytest-16/test_hash_fails0/test.py F E E =================================== FAILURES =================================== E _______________________________ test_hash_fails ________________________________ E E args = (), kwargs = {}, fig =
E result_dir = PosixPath('/tmp/tmpucyb4y30/test.test_hash_fails') E E @wraps(item.function) E def item_function_wrapper(*args, **kwargs): E E with plt.style.context(style, after_reset=True), switch_backend(backend): E E # Run test and get figure object E if inspect.ismethod(original): # method E # In some cases, for example if setup_method is used, E # original appears to belong to an instance of the test E # class that is not the same as args[0], and args[0] is the E # one that has the correct attributes set up from setup_method E # so we ignore original.__self__ and use args[0] instead. E fig = original.__func__(*args, **kwargs) E else: # function E fig = original(*args, **kwargs) E E if remove_text: E remove_ticks_and_titles(fig) E E # What we do now depends on whether we are generating the E # reference images or simply running the test. E if self.generate_dir is not None: E self.generate_baseline_image(item, fig) E E if self.generate_hash_library is not None: E hash_name = self.generate_test_name(item) E self._generated_hash_library[hash_name] = self.generate_image_hash(item, fig) E E # Only test figures if we are not generating hashes or images E if self.generate_dir is None and self.generate_hash_library is None: E result_dir = self.make_test_results_dir(item) E E # Compare to hash library E if self.hash_library or compare.kwargs.get('hash_library', None): E > msg = self.compare_image_to_hash_library(item, fig, result_dir) E E ../../.tox/py38/lib/python3.8/site-packages/pytest_mpl/plugin.py:565: E _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ E E self = E item = , fig =
E result_dir = PosixPath('/tmp/tmpucyb4y30/test.test_hash_fails') E E def compare_image_to_hash_library(self, item, fig, result_dir): E compare = self.get_compare(item) E savefig_kwargs = compare.kwargs.get('savefig_kwargs', {}) E E hash_library_filename = self.hash_library or compare.kwargs.get('hash_library', None) E hash_library_filename = (Path(item.fspath).parent / hash_library_filename).absolute() E E if not Path(hash_library_filename).exists(): E > pytest.fail(f"Can't find hash library at path {hash_library_filename}") E E Failed: Can't find hash library at path /tmp/tmp28z5lwb5/pytest-mpl-0.12/tests/baseline/test_hash_lib.json E E ../../.tox/py38/lib/python3.8/site-packages/pytest_mpl/plugin.py:465: Failed E =========================== short test summary info ============================ E FAILED ../../../../pytest-of-travis/pytest-16/test_hash_fails0/test.py::test_hash_fails E ============================== 1 failed in 2.47s =============================== E E assert "doesn't match hash FAIL in library" in '============================= test session starts ==============================\nplatform linux -- Python 3.8.0, pyt...sh_fails0/test.py::test_hash_fails\n============================== 1 failed in 2.47s ===============================\n' ../../tests/test_pytest_mpl.py:52: AssertionError ____________________________ test_hash_fail_hybrid _____________________________ args = ['--mpl', '/tmp/pytest-of-travis/pytest-16/test_hash_fail_hybrid0/test.py', '--mpl-baseline-path=/tmp/tmp28z5lwb5/pytest-mpl-0.12/tests/baseline/hybrid/fail'] output_substring = "doesn't match hash FAIL in library" def assert_pytest_fails_with(args, output_substring): try: > subprocess.check_output([sys.executable, '-m', 'pytest', '-s'] + args) ../../tests/test_pytest_mpl.py:49: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ timeout = None popenargs = (['/tmp/tmp28z5lwb5/pytest-mpl-0.12/.tox/py38/bin/python', '-m', 'pytest', '-s', '--mpl', '/tmp/pytest-of-travis/pytest-16/test_hash_fail_hybrid0/test.py', ...],) kwargs = {} def check_output(*popenargs, timeout=None, **kwargs): r"""Run command with arguments and return its output. If the exit code was non-zero it raises a CalledProcessError. The CalledProcessError object will have the return code in the returncode attribute and output in the output attribute. The arguments are the same as for the Popen constructor. Example: >>> check_output(["ls", "-l", "/dev/null"]) b'crw-rw-rw- 1 root root 1, 3 Oct 18 2007 /dev/null\n' The stdout argument is not allowed as it is used internally. To capture standard error in the result, use stderr=STDOUT. >>> check_output(["/bin/sh", "-c", ... "ls -l non_existent_file ; exit 0"], ... stderr=STDOUT) b'ls: non_existent_file: No such file or directory\n' There is an additional optional argument, "input", allowing you to pass a string to the subprocess's stdin. If you use this argument you may not also use the Popen constructor's "stdin" argument, as it too will be used internally. Example: >>> check_output(["sed", "-e", "s/foo/bar/"], ... input=b"when in the course of fooman events\n") b'when in the course of barman events\n' By default, all communication is in bytes, and therefore any "input" should be bytes, and the return value will be bytes. If in text mode, any "input" should be a string, and the return value will be a string decoded according to locale encoding, or by "encoding" if set. Text mode is triggered by setting any of text, encoding, errors or universal_newlines. """ if 'stdout' in kwargs: raise ValueError('stdout argument not allowed, it will be overridden.') if 'input' in kwargs and kwargs['input'] is None: # Explicitly passing input=None was previously equivalent to passing an # empty string. That is maintained here for backwards compatibility. kwargs['input'] = '' if kwargs.get('universal_newlines', False) else b'' > return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, **kwargs).stdout /opt/python/3.8.0/lib/python3.8/subprocess.py:411: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ input = None, capture_output = False, timeout = None, check = True popenargs = (['/tmp/tmp28z5lwb5/pytest-mpl-0.12/.tox/py38/bin/python', '-m', 'pytest', '-s', '--mpl', '/tmp/pytest-of-travis/pytest-16/test_hash_fail_hybrid0/test.py', ...],) kwargs = {'stdout': -1}, process = stdout = b'============================= test session starts ==============================\nplatform linux -- Python 3.8.0, py...id0/test.py::test_hash_fail_hybrid\n============================== 1 failed in 2.64s ===============================\n' stderr = None, retcode = 1 def run(*popenargs, input=None, capture_output=False, timeout=None, check=False, **kwargs): """Run command with arguments and return a CompletedProcess instance. The returned instance will have attributes args, returncode, stdout and stderr. By default, stdout and stderr are not captured, and those attributes will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them. If check is True and the exit code was non-zero, it raises a CalledProcessError. The CalledProcessError object will have the return code in the returncode attribute, and output & stderr attributes if those streams were captured. If timeout is given, and the process takes too long, a TimeoutExpired exception will be raised. There is an optional argument "input", allowing you to pass bytes or a string to the subprocess's stdin. If you use this argument you may not also use the Popen constructor's "stdin" argument, as it will be used internally. By default, all communication is in bytes, and therefore any "input" should be bytes, and the stdout and stderr will be bytes. If in text mode, any "input" should be a string, and stdout and stderr will be strings decoded according to locale encoding, or by "encoding" if set. Text mode is triggered by setting any of text, encoding, errors or universal_newlines. The other arguments are the same as for the Popen constructor. """ if input is not None: if kwargs.get('stdin') is not None: raise ValueError('stdin and input arguments may not both be used.') kwargs['stdin'] = PIPE if capture_output: if kwargs.get('stdout') is not None or kwargs.get('stderr') is not None: raise ValueError('stdout and stderr arguments may not be used ' 'with capture_output.') kwargs['stdout'] = PIPE kwargs['stderr'] = PIPE with Popen(*popenargs, **kwargs) as process: try: stdout, stderr = process.communicate(input, timeout=timeout) except TimeoutExpired as exc: process.kill() if _mswindows: # Windows accumulates the output in a single blocking # read() call run on child threads, with the timeout # being done in a join() on those threads. communicate() # _after_ kill() is required to collect that and add it # to the exception. exc.stdout, exc.stderr = process.communicate() else: # POSIX _communicate already populated the output so # far into the TimeoutExpired exception. process.wait() raise except: # Including KeyboardInterrupt, communicate handled that. process.kill() # We don't call process.wait() as .__exit__ does that for us. raise retcode = process.poll() if check and retcode: > raise CalledProcessError(retcode, process.args, output=stdout, stderr=stderr) E subprocess.CalledProcessError: Command '['/tmp/tmp28z5lwb5/pytest-mpl-0.12/.tox/py38/bin/python', '-m', 'pytest', '-s', '--mpl', '/tmp/pytest-of-travis/pytest-16/test_hash_fail_hybrid0/test.py', '--mpl-baseline-path=/tmp/tmp28z5lwb5/pytest-mpl-0.12/tests/baseline/hybrid/fail']' returned non-zero exit status 1. /opt/python/3.8.0/lib/python3.8/subprocess.py:512: CalledProcessError During handling of the above exception, another exception occurred: tmpdir = local('/tmp/pytest-of-travis/pytest-16/test_hash_fail_hybrid0') @pytest.mark.skipif(ftv != '261', reason="Incorrect freetype version for hash check") def test_hash_fail_hybrid(tmpdir): test_file = tmpdir.join('test.py').strpath with open(test_file, 'w', encoding='ascii') as f: f.write(TEST_FAILING_HYBRID) # Assert that image comparison runs and fails > output = assert_pytest_fails_with(['--mpl', test_file, rf'--mpl-baseline-path={hash_baseline_dir_abs / "fail"}'], "doesn't match hash FAIL in library") ../../tests/test_pytest_mpl.py:329: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ args = ['--mpl', '/tmp/pytest-of-travis/pytest-16/test_hash_fail_hybrid0/test.py', '--mpl-baseline-path=/tmp/tmp28z5lwb5/pytest-mpl-0.12/tests/baseline/hybrid/fail'] output_substring = "doesn't match hash FAIL in library" def assert_pytest_fails_with(args, output_substring): try: subprocess.check_output([sys.executable, '-m', 'pytest', '-s'] + args) except subprocess.CalledProcessError as exc: output = exc.output.decode() > assert output_substring in output, output E AssertionError: ============================= test session starts ============================== E platform linux -- Python 3.8.0, pytest-6.1.2, py-1.9.0, pluggy-0.13.1 E cachedir: tmp28z5lwb5/pytest-mpl-0.12/.tox/py38/.pytest_cache E Matplotlib: 3.3.3 E Freetype: 2.6.1 E rootdir: /tmp E plugins: cov-2.10.1, mpl-0.12 E collected 1 item E E ../../../../pytest-of-travis/pytest-16/test_hash_fail_hybrid0/test.py F E E =================================== FAILURES =================================== E ____________________________ test_hash_fail_hybrid _____________________________ E E args = (), kwargs = {}, fig =
E result_dir = PosixPath('/tmp/tmp883yjley/test.test_hash_fail_hybrid') E E @wraps(item.function) E def item_function_wrapper(*args, **kwargs): E E with plt.style.context(style, after_reset=True), switch_backend(backend): E E # Run test and get figure object E if inspect.ismethod(original): # method E # In some cases, for example if setup_method is used, E # original appears to belong to an instance of the test E # class that is not the same as args[0], and args[0] is the E # one that has the correct attributes set up from setup_method E # so we ignore original.__self__ and use args[0] instead. E fig = original.__func__(*args, **kwargs) E else: # function E fig = original(*args, **kwargs) E E if remove_text: E remove_ticks_and_titles(fig) E E # What we do now depends on whether we are generating the E # reference images or simply running the test. E if self.generate_dir is not None: E self.generate_baseline_image(item, fig) E E if self.generate_hash_library is not None: E hash_name = self.generate_test_name(item) E self._generated_hash_library[hash_name] = self.generate_image_hash(item, fig) E E # Only test figures if we are not generating hashes or images E if self.generate_dir is None and self.generate_hash_library is None: E result_dir = self.make_test_results_dir(item) E E # Compare to hash library E if self.hash_library or compare.kwargs.get('hash_library', None): E > msg = self.compare_image_to_hash_library(item, fig, result_dir) E E ../../.tox/py38/lib/python3.8/site-packages/pytest_mpl/plugin.py:565: E _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ E E self = E item = , fig =
E result_dir = PosixPath('/tmp/tmp883yjley/test.test_hash_fail_hybrid') E E def compare_image_to_hash_library(self, item, fig, result_dir): E compare = self.get_compare(item) E savefig_kwargs = compare.kwargs.get('savefig_kwargs', {}) E E hash_library_filename = self.hash_library or compare.kwargs.get('hash_library', None) E hash_library_filename = (Path(item.fspath).parent / hash_library_filename).absolute() E E if not Path(hash_library_filename).exists(): E > pytest.fail(f"Can't find hash library at path {hash_library_filename}") E E Failed: Can't find hash library at path /tmp/tmp28z5lwb5/pytest-mpl-0.12/tests/baseline/test_hash_lib.json E E ../../.tox/py38/lib/python3.8/site-packages/pytest_mpl/plugin.py:465: Failed E =========================== short test summary info ============================ E FAILED ../../../../pytest-of-travis/pytest-16/test_hash_fail_hybrid0/test.py::test_hash_fail_hybrid E ============================== 1 failed in 2.64s =============================== E E assert "doesn't match hash FAIL in library" in '============================= test session starts ==============================\nplatform linux -- Python 3.8.0, pyt...id0/test.py::test_hash_fail_hybrid\n============================== 1 failed in 2.64s ===============================\n' ../../tests/test_pytest_mpl.py:52: AssertionError ______________________________ test_hash_missing _______________________________ args = ['--mpl', '/tmp/pytest-of-travis/pytest-16/test_hash_missing0/test.py', '--mpl-hash-library=/tmp/tmp28z5lwb5/pytest-mpl-0.12/tests/baseline/test_hash_lib.json'] output_substring = "Hash for test 'test.test_hash_missing' not found in" def assert_pytest_fails_with(args, output_substring): try: > subprocess.check_output([sys.executable, '-m', 'pytest', '-s'] + args) ../../tests/test_pytest_mpl.py:49: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ timeout = None popenargs = (['/tmp/tmp28z5lwb5/pytest-mpl-0.12/.tox/py38/bin/python', '-m', 'pytest', '-s', '--mpl', '/tmp/pytest-of-travis/pytest-16/test_hash_missing0/test.py', ...],) kwargs = {} def check_output(*popenargs, timeout=None, **kwargs): r"""Run command with arguments and return its output. If the exit code was non-zero it raises a CalledProcessError. The CalledProcessError object will have the return code in the returncode attribute and output in the output attribute. The arguments are the same as for the Popen constructor. Example: >>> check_output(["ls", "-l", "/dev/null"]) b'crw-rw-rw- 1 root root 1, 3 Oct 18 2007 /dev/null\n' The stdout argument is not allowed as it is used internally. To capture standard error in the result, use stderr=STDOUT. >>> check_output(["/bin/sh", "-c", ... "ls -l non_existent_file ; exit 0"], ... stderr=STDOUT) b'ls: non_existent_file: No such file or directory\n' There is an additional optional argument, "input", allowing you to pass a string to the subprocess's stdin. If you use this argument you may not also use the Popen constructor's "stdin" argument, as it too will be used internally. Example: >>> check_output(["sed", "-e", "s/foo/bar/"], ... input=b"when in the course of fooman events\n") b'when in the course of barman events\n' By default, all communication is in bytes, and therefore any "input" should be bytes, and the return value will be bytes. If in text mode, any "input" should be a string, and the return value will be a string decoded according to locale encoding, or by "encoding" if set. Text mode is triggered by setting any of text, encoding, errors or universal_newlines. """ if 'stdout' in kwargs: raise ValueError('stdout argument not allowed, it will be overridden.') if 'input' in kwargs and kwargs['input'] is None: # Explicitly passing input=None was previously equivalent to passing an # empty string. That is maintained here for backwards compatibility. kwargs['input'] = '' if kwargs.get('universal_newlines', False) else b'' > return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, **kwargs).stdout /opt/python/3.8.0/lib/python3.8/subprocess.py:411: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ input = None, capture_output = False, timeout = None, check = True popenargs = (['/tmp/tmp28z5lwb5/pytest-mpl-0.12/.tox/py38/bin/python', '-m', 'pytest', '-s', '--mpl', '/tmp/pytest-of-travis/pytest-16/test_hash_missing0/test.py', ...],) kwargs = {'stdout': -1}, process = stdout = b'============================= test session starts ==============================\nplatform linux -- Python 3.8.0, py...issing0/test.py::test_hash_missing\n============================== 1 failed in 2.47s ===============================\n' stderr = None, retcode = 1 def run(*popenargs, input=None, capture_output=False, timeout=None, check=False, **kwargs): """Run command with arguments and return a CompletedProcess instance. The returned instance will have attributes args, returncode, stdout and stderr. By default, stdout and stderr are not captured, and those attributes will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them. If check is True and the exit code was non-zero, it raises a CalledProcessError. The CalledProcessError object will have the return code in the returncode attribute, and output & stderr attributes if those streams were captured. If timeout is given, and the process takes too long, a TimeoutExpired exception will be raised. There is an optional argument "input", allowing you to pass bytes or a string to the subprocess's stdin. If you use this argument you may not also use the Popen constructor's "stdin" argument, as it will be used internally. By default, all communication is in bytes, and therefore any "input" should be bytes, and the stdout and stderr will be bytes. If in text mode, any "input" should be a string, and stdout and stderr will be strings decoded according to locale encoding, or by "encoding" if set. Text mode is triggered by setting any of text, encoding, errors or universal_newlines. The other arguments are the same as for the Popen constructor. """ if input is not None: if kwargs.get('stdin') is not None: raise ValueError('stdin and input arguments may not both be used.') kwargs['stdin'] = PIPE if capture_output: if kwargs.get('stdout') is not None or kwargs.get('stderr') is not None: raise ValueError('stdout and stderr arguments may not be used ' 'with capture_output.') kwargs['stdout'] = PIPE kwargs['stderr'] = PIPE with Popen(*popenargs, **kwargs) as process: try: stdout, stderr = process.communicate(input, timeout=timeout) except TimeoutExpired as exc: process.kill() if _mswindows: # Windows accumulates the output in a single blocking # read() call run on child threads, with the timeout # being done in a join() on those threads. communicate() # _after_ kill() is required to collect that and add it # to the exception. exc.stdout, exc.stderr = process.communicate() else: # POSIX _communicate already populated the output so # far into the TimeoutExpired exception. process.wait() raise except: # Including KeyboardInterrupt, communicate handled that. process.kill() # We don't call process.wait() as .__exit__ does that for us. raise retcode = process.poll() if check and retcode: > raise CalledProcessError(retcode, process.args, output=stdout, stderr=stderr) E subprocess.CalledProcessError: Command '['/tmp/tmp28z5lwb5/pytest-mpl-0.12/.tox/py38/bin/python', '-m', 'pytest', '-s', '--mpl', '/tmp/pytest-of-travis/pytest-16/test_hash_missing0/test.py', '--mpl-hash-library=/tmp/tmp28z5lwb5/pytest-mpl-0.12/tests/baseline/test_hash_lib.json']' returned non-zero exit status 1. /opt/python/3.8.0/lib/python3.8/subprocess.py:512: CalledProcessError During handling of the above exception, another exception occurred: tmpdir = local('/tmp/pytest-of-travis/pytest-16/test_hash_missing0') def test_hash_missing(tmpdir): test_file = tmpdir.join('test.py').strpath with open(test_file, 'w') as f: f.write(TEST_MISSING_HASH) # Assert fails if hash library missing assert_pytest_fails_with(['--mpl', test_file, '--mpl-hash-library=/not/a/path'], "Can't find hash library at path") # Assert fails if hash not in library > assert_pytest_fails_with(['--mpl', test_file, f'--mpl-hash-library={fail_hash_library}'], "Hash for test 'test.test_hash_missing' not found in") ../../tests/test_pytest_mpl.py:374: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ args = ['--mpl', '/tmp/pytest-of-travis/pytest-16/test_hash_missing0/test.py', '--mpl-hash-library=/tmp/tmp28z5lwb5/pytest-mpl-0.12/tests/baseline/test_hash_lib.json'] output_substring = "Hash for test 'test.test_hash_missing' not found in" def assert_pytest_fails_with(args, output_substring): try: subprocess.check_output([sys.executable, '-m', 'pytest', '-s'] + args) except subprocess.CalledProcessError as exc: output = exc.output.decode() > assert output_substring in output, output E AssertionError: ============================= test session starts ============================== E platform linux -- Python 3.8.0, pytest-6.1.2, py-1.9.0, pluggy-0.13.1 E cachedir: tmp28z5lwb5/pytest-mpl-0.12/.tox/py38/.pytest_cache E Matplotlib: 3.3.3 E Freetype: 2.6.1 E rootdir: /tmp E plugins: cov-2.10.1, mpl-0.12 E collected 1 item E E ../../../../pytest-of-travis/pytest-16/test_hash_missing0/test.py F E E =================================== FAILURES =================================== E ______________________________ test_hash_missing _______________________________ E E args = (), kwargs = {}, fig =
E result_dir = PosixPath('/tmp/tmpl7rtfz_l/test.test_hash_missing') E E @wraps(item.function) E def item_function_wrapper(*args, **kwargs): E E with plt.style.context(style, after_reset=True), switch_backend(backend): E E # Run test and get figure object E if inspect.ismethod(original): # method E # In some cases, for example if setup_method is used, E # original appears to belong to an instance of the test E # class that is not the same as args[0], and args[0] is the E # one that has the correct attributes set up from setup_method E # so we ignore original.__self__ and use args[0] instead. E fig = original.__func__(*args, **kwargs) E else: # function E fig = original(*args, **kwargs) E E if remove_text: E remove_ticks_and_titles(fig) E E # What we do now depends on whether we are generating the E # reference images or simply running the test. E if self.generate_dir is not None: E self.generate_baseline_image(item, fig) E E if self.generate_hash_library is not None: E hash_name = self.generate_test_name(item) E self._generated_hash_library[hash_name] = self.generate_image_hash(item, fig) E E # Only test figures if we are not generating hashes or images E if self.generate_dir is None and self.generate_hash_library is None: E result_dir = self.make_test_results_dir(item) E E # Compare to hash library E if self.hash_library or compare.kwargs.get('hash_library', None): E > msg = self.compare_image_to_hash_library(item, fig, result_dir) E E ../../.tox/py38/lib/python3.8/site-packages/pytest_mpl/plugin.py:565: E _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ E E self = E item = , fig =
E result_dir = PosixPath('/tmp/tmpl7rtfz_l/test.test_hash_missing') E E def compare_image_to_hash_library(self, item, fig, result_dir): E compare = self.get_compare(item) E savefig_kwargs = compare.kwargs.get('savefig_kwargs', {}) E E hash_library_filename = self.hash_library or compare.kwargs.get('hash_library', None) E hash_library_filename = (Path(item.fspath).parent / hash_library_filename).absolute() E E if not Path(hash_library_filename).exists(): E > pytest.fail(f"Can't find hash library at path {hash_library_filename}") E E Failed: Can't find hash library at path /tmp/tmp28z5lwb5/pytest-mpl-0.12/tests/baseline/test_hash_lib.json E E ../../.tox/py38/lib/python3.8/site-packages/pytest_mpl/plugin.py:465: Failed E =========================== short test summary info ============================ E FAILED ../../../../pytest-of-travis/pytest-16/test_hash_missing0/test.py::test_hash_missing E ============================== 1 failed in 2.47s =============================== E E assert "Hash for test 'test.test_hash_missing' not found in" in '============================= test session starts ==============================\nplatform linux -- Python 3.8.0, pyt...issing0/test.py::test_hash_missing\n============================== 1 failed in 2.47s ===============================\n' ../../tests/test_pytest_mpl.py:52: AssertionError =========================== short test summary info ============================ FAILED ../../tests/test_pytest_mpl.py::test_hash_fails - AssertionError: ====... FAILED ../../tests/test_pytest_mpl.py::test_hash_fail_hybrid - AssertionError... FAILED ../../tests/test_pytest_mpl.py::test_hash_missing - AssertionError: ==... =================== 3 failed, 16 passed, 1 skipped in 56.06s =================== ERROR: InvocationError for command /tmp/tmp28z5lwb5/pytest-mpl-0.12/.tox/py38/bin/pytest /tmp/tmp28z5lwb5/pytest-mpl-0.12 (exited with code 1) ___________________________________ summary ____________________________________ ERROR: py38: commands failed write json report at: /tmp/tmp28z5lwb5/pytest-mpl-0.12/result.json Time: 141.1 seconds