|
| 1 | +""" Profiles basic -jX functionality """ |
| 2 | +# Copyright (c) 2020 Frank Harrison <[email protected]> |
| 3 | + |
| 4 | +# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
| 5 | +# For details: https://github.com/PyCQA/pylint/blob/master/COPYING |
| 6 | + |
| 7 | +# pylint: disable=protected-access,missing-function-docstring,no-self-use |
| 8 | + |
| 9 | +import os |
| 10 | + |
| 11 | +import pytest |
| 12 | + |
| 13 | +from pylint.lint import Run |
| 14 | +from pylint.testutils import TestReporter as Reporter |
| 15 | + |
| 16 | + |
| 17 | +def _get_py_files(scanpath): |
| 18 | + assert os.path.exists(scanpath), "Dir not found %s" % scanpath |
| 19 | + |
| 20 | + filepaths = [] |
| 21 | + for _dirpath, dirnames, filenames in os.walk(scanpath): |
| 22 | + dirnames[:] = [dirname for dirname in dirnames if dirname != "__pycache__"] |
| 23 | + filepaths.extend( |
| 24 | + [filename for filename in filenames if filename.endswith(".py")] |
| 25 | + ) |
| 26 | + return filepaths |
| 27 | + |
| 28 | + |
| 29 | +@pytest.mark.skipif( |
| 30 | + os.environ.get("PYTEST_PROFILE_NUMPY", False), |
| 31 | + reason="PYTEST_PROFILE_NUMPY, not set, assuming not a profile run", |
| 32 | +) |
| 33 | +class TestEstablishBaselineBenchmarks: |
| 34 | + """ Runs against numpy """ |
| 35 | + |
| 36 | + def test_run(self): |
| 37 | + |
| 38 | + numpy_checkout_path = os.path.abspath( |
| 39 | + os.path.dirname(os.path.dirname(os.path.dirname(__file__))) |
| 40 | + ) |
| 41 | + filepaths = _get_py_files(scanpath=numpy_checkout_path) |
| 42 | + |
| 43 | + Run(filepaths, reporter=Reporter(), do_exit=False) |
| 44 | + |
| 45 | + # assert runner.linter.msg_status == 0, ( |
| 46 | + # "Expected no errors to be thrown: %s" |
| 47 | + # % pprint.pformat(runner.linter.reporter.messages) |
| 48 | + # ) |
0 commit comments