summaryrefslogtreecommitdiff
path: root/tests/test_api.py
Commit message (Collapse)AuthorAgeFilesLines
* 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
* refactor: unittest2pytest -w testsNed Batchelder2021-01-311-105/+96
| | | | One step of moving to pure pytest tests.
* Add combine --keep (#1110)Éric Larivière2021-01-301-1/+1
| | | | | | | | | | | * Add combine --keep Related to https://github.com/nedbat/coveragepy/issues/1108 * Fix unit tests * Fix line too long * Fix line too long
* Always output TOTAL line.Judson Neer2021-01-061-2/+10
|
* Fix tests for GitHub windows platformNed Batchelder2020-11-281-4/+4
| | | | | | | | | | | | | | The tests were failing because of differences in file paths. It was comparing: C:\Users\runneradmin\AppData\... to: C:\Users\RUNNER~1\AppData\... and failing. These changes normalize the file paths so the comparisons work properly.
* ambigious -> ambiguousNed Batchelder2020-09-121-9/+9
|
* Docs and cleanup for source_pkgsNed Batchelder2020-09-121-7/+2
|
* Create Way to force package even if filepath exists (#1026)Thomas Grainger2020-09-121-0/+22
| | | Fixes: #268
* replace confusing comment with assertion (#1028)Thomas Grainger2020-09-121-3/+12
|
* More bitbucket->github urlsNed Batchelder2020-08-181-3/+3
|
* A test replicating #916Ned Batchelder2020-01-071-2/+11
|
* Ensure file touching happens if nothing was measured. #884Ned Batchelder2020-01-041-0/+15
|
* Fix --debug=sys. #907Ned Batchelder2019-12-281-0/+8
|
* Warn if two things change the dynamic context. #901Ned Batchelder2019-12-271-0/+13
|
* Warnings can be marked to only display once.Ned Batchelder2019-12-271-3/+13
|
* A way to artificially crash coverage, for testing.Ned Batchelder2019-12-231-0/+15
|
* Detect when a 4.x data file is being read. #886Ned Batchelder2019-12-221-5/+12
|
* Don't need to check for JSON-era bad-data messages any moreNed Batchelder2019-12-221-5/+0
|
* Coverage(data_file=None) means no data file at all. #871Ned Batchelder2019-12-021-1/+26
|
* The [paths] setting is ordered. #649Ned Batchelder2019-12-011-0/+43
|
* Experimental: relative_files to support relative file names.Ned Batchelder2019-12-011-0/+91
|