summaryrefslogtreecommitdiff
path: root/tests/test_api.py
Commit message (Collapse)AuthorAgeFilesLines
* refactor(test): move some tests to a new fileNed Batchelder2023-05-141-145/+1
|
* fix: Path objects are ok for data_file and config_file. #1552Ned Batchelder2023-02-121-5/+7
|
* feat: simplify purges_filesNed Batchelder2023-02-081-106/+0
| | | | Also, move tests to test_data.py, and finish covering the code.
* feat: add purge_files method to CoverageData + unit tests for it (#1547)Wingware Development2023-02-041-0/+106
| | | | | | | | | | | | | | | * Add purge_files method to CoverageData, to allow for selective removal and update of coverage data. * Fix assert syntax so it's not true; this code isn't reached in the test unless it fails and then it would have failed to fail. * Remove trailing whitespace; did not expect this would matter on a blank line. * Add type annotations required by mypy --------- Co-authored-by: Stephan Deibel <sdeibel@wingware.com>
* style: use good style for annotated defaults parametersNed Batchelder2023-01-051-2/+2
|
* mypy: use __future__ uniformly in checked filesNed Batchelder2023-01-051-0/+2
|
* test: a sorted_lines helperNed Batchelder2022-12-311-5/+5
|
* mypy: add data.py and test_api.pyNed Batchelder2022-12-311-136/+155
|
* test: add a test of unknown dynamic-contextNed Batchelder2022-12-311-0/+6
|
* style: correct some lint errorsNed Batchelder2022-12-301-2/+0
|
* mypy: inorout.py, disposition.py, and part of control.pyNed Batchelder2022-12-301-0/+2
|
* feat: file paths are only remapped if the result existsNed Batchelder2022-11-291-10/+13
|
* style: fix spellingNed Batchelder2022-11-281-6/+6
| | | | un-executed, white space, time stamp.
* feat: implicit path mapping during reporting. #1212Ned Batchelder2022-11-271-1/+145
|
* perf: hash data files during combining to avoid unneeded work. #1483Ned Batchelder2022-11-081-1/+1
| | | | | | | | | When generating many parallel data files, often some data files will be exact copies of each other. Checking the hashes, we can avoid combining the duplicates, speeding the process. On a coverage.py metacov, we had 651 duplicates out of 2189 files (29%). The time to combine was reduced by 17%.
* fix: more relative_files=true fixes. #1280Ned Batchelder2022-10-301-0/+32
|
* fix: use glob matching instead of fnmatch. #1407Ned Batchelder2022-10-301-1/+0
| | | | | | | I didn't understand that fnmatch considers the entire string to be a filename, even if it has slashes in it. This led to incorrect matching. Now we use our own implementation of glob matching to get the correct behavior.
* test: copying __pycache__ was causing race conditions, and was unneeded anyway.Ned Batchelder2022-07-081-1/+5
|
* style: parens should indent the same as their opening lineNed Batchelder2022-05-011-2/+2
|
* test: SQLite errors come in a few formsNed Batchelder2022-02-061-3/+4
|
* test(refactor): avoid full commands to speed testsNed Batchelder2021-11-261-1/+187
| | | | Also btw, I think some of these tests are duplicative.
* test(fix): keep SourceIncludeOmitTest's from clobbering each otherNed Batchelder2021-11-241-8/+20
| | | | | | | | Because they cd'd into a folder in the shared source tree, their data files would collide, leading to flaky tests. Also, add a check that the tests collected some data, and add sys.path to the debug=trace output.
* refactor(test): make_data_file is a helper for making data filesNed Batchelder2021-11-201-4/+7
|
* fix: suffix=False will suppress the suffix even with multiprocessing. #989Ned Batchelder2021-11-181-0/+20
|
* refactor: specialize exceptionsNed Batchelder2021-11-141-5/+5
| | | | | | CoverageException is fine as a base class, but not good to use for raising (and catching sometimes). Introduce specialized exceptions that allow third-party tools to integrate better.
* refactor: add_lines only needs an iterable of intsNed Batchelder2021-11-131-2/+2
| | | | | The old code expected a dict with int keys, but iterables are simpler, so get rid of a lot of dict.fromkeys() nonsense.
* fix: remapping paths during combining needs to follow relative_files=True. #1147Ned Batchelder2021-11-061-9/+18
|
* style: remove implicit string concatenationNed Batchelder2021-10-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | .. and also add trailing commas where needed to remove ambiguity. I used semgrep with this config: ``` rules: - id: implicit-string-concatenation pattern: | "$X" "$Y" languages: - python message: string cat BAD severity: INFO ``` Running it showed this: ``` $ semgrep --config=../lab/string-cat.yml coverage tests doc ci igor.py setup.py __main__.py Running 1 rules... setup.py severity:info rule:lab.implicit-string-concatenation: string cat BAD 128: 'https://tidelift.com/subscription/pkg/pypi-coverage' 129: '?utm_source=pypi-coverage&utm_medium=referral&utm_campaign=pypi' tests/test_api.py severity:info rule:lab.implicit-string-concatenation: string cat BAD 319: "!coverage.py: This is a private format, don't read it directly!" 320: '{"lines":{"/private/tmp/foo.py":[1,5,2,3]}}' tests/test_html.py severity:info rule:lab.implicit-string-concatenation: string cat BAD 614: ('<span class="key">if</span> <span class="num">1</span> ' 615: '<span class="op">&lt;</span> <span class="num">2</span>'), -------------------------------------------------------------------------------- 616: (' <span class="nam">a</span> ' 617: '<span class="op">=</span> <span class="num">3</span>'), -------------------------------------------------------------------------------- 665: ('<span class="key">if</span> <span class="nam">x</span> ' 666: '<span class="op">&lt;</span> <span class="num">2</span>'), -------------------------------------------------------------------------------- 667: (' <span class="nam">a</span> <span class="op">=</span> ' 668: '<span class="num">3</span>'), -------------------------------------------------------------------------------- 949: ('<span class="key">if</span> <span class="num">1</span> ' 950: '<span class="op">&lt;</span> <span class="num">2</span>'), -------------------------------------------------------------------------------- 951: (' <span class="nam">a</span> <span class="op">=</span> ' 952: '<span class="num">3</span>'), ran 1 rules on 134 files: 8 findings ``` This wasn't all of the instances, so I wrote a bug report: https://github.com/returntocorp/semgrep/issues/4184
* test: exclude one last line in test_api.pyNed Batchelder2021-08-091-1/+1
|
* feat: `coverage combine` now prints messages naming the files being ↵Ned Batchelder2021-08-051-0/+4
| | | | combined. #1105 (#1208)
* feat: warnings are now real warningsNed Batchelder2021-05-301-36/+40
| | | | | | This makes coverage warnings visible when running test suites under pytest. But it also means some uninteresting warnings would show up in our own test suite, so we had to catch or suppress those.
* refactor: move exceptions to their own moduleNed Batchelder2021-05-021-1/+2
|
* refactor: pyupgrade --py36-plus tests/**.pyNed Batchelder2021-05-021-2/+2
|
* refactor: move the remaining backward.py code, no more backward.pyNed Batchelder2021-05-011-2/+1
|
* refactor: remove some unneeded behavior conditionalsNed Batchelder2021-05-011-3/+0
|
* refactor: remove yet more unneeded backward.py shimsNed Batchelder2021-05-011-2/+2
| | | | | | | | Gone are: - PYC_MAGIC_NUMBER - code_object - SimpleNamespace
* refactor: remove unneeded backward.py shimsNed Batchelder2021-05-011-3/+4
| | | | | | | | | | | | | | | Removed were: - StringIO - configparser - string_class - unicode_class - range - zip_longest - get_thread_id - path_types - shlex_quote - reprlib
* refactor: nice_file can be used as a functionNed Batchelder2021-03-221-5/+5
|
* refactor: remove unused test class settingNed Batchelder2021-03-111-4/+0
| | | | | | | | | unittest_mixins would check that files got created if a test made a temporary directory, so that we could trim down making temp dirs needlessly. But we don't use unittest_mixins any more, so this setting does nothing. Remove it.
* refactor: our own change_dir context managerNed Batchelder2021-03-111-2/+1
| | | | We don't need to use the one from unittest_mixins.
* test: simplify how StopEverything is converted to skipnedbat/remove-unittest-testcaseNed Batchelder2021-03-111-2/+2
| | | | | | The auto-decorating metaclass was interfering with parameterized methods on Python 2.7. But we don't need it anymore anyway, since pytest will let us hook to deal with the exception in a simpler way.
* test: reduce use of unittestNed Batchelder2021-03-111-4/+4
|
* test: oops, accidentally always skipped this testNed Batchelder2021-02-241-1/+1
|
* refactor: convert all skipping to pytest skipsNed Batchelder2021-02-071-5/+3
|
* refactor: remove unittest.assertCountEqualNed Batchelder2021-02-061-1/+2
| | | | Another step toward removing unittest.TestCase.
* refactor: remove reliance on unittest_mixins.StdStreamCapturingMixinNed Batchelder2021-02-021-6/+2
| | | | This is another step toward removing unittest.TestCase as a base class.
* refactor: move test mixins to their own fileNed Batchelder2021-02-021-2/+2
|
* style: fix long lines and avoid backslashesnedbat/unittest2pytestNed Batchelder2021-01-311-8/+6
|
* style: correct placement of auto-added pytest importsNed Batchelder2021-01-311-1/+1
|
* style: singleton comparisons should use isNed Batchelder2021-01-311-3/+3
| | | | | | I guess the original line was wrong, but it would have been nice for unittest2pytest to fix it for me: https://github.com/pytest-dev/unittest2pytest/issues/52