Anthony Sottile
4cd0322ca1
replace atomicwrites with os.replace
2022-07-08 18:36:10 -07:00
Ran Benita
22756c28e5
Merge pull request #9768 from bluetech/fix-tests-verbose
...
testing: fix tests when run under `-v` or `-vv`
2022-03-17 18:17:17 +02:00
pre-commit-ci[bot]
d52a6e6074
[pre-commit.ci] pre-commit autoupdate ( #9769 )
...
* [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/reorder_python_imports: v2.7.1 → v3.0.1](https://github.com/asottile/reorder_python_imports/compare/v2.7.1...v3.0.1 )
- [github.com/asottile/pyupgrade: v2.31.0 → v2.31.1](https://github.com/asottile/pyupgrade/compare/v2.31.0...v2.31.1 )
- [github.com/pre-commit/mirrors-mypy: v0.931 → v0.940](https://github.com/pre-commit/mirrors-mypy/compare/v0.931...v0.940 )
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix mypy errors
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2022-03-16 21:34:40 +02:00
Ran Benita
37fa0fb4d3
testing: fix tests when run under `-v` or `-vv`
...
Regressed in fac8f284cd
, didn't notice
since we don't run tests in CI with `-v`.
2022-03-14 22:27:52 +02:00
Anthony Sottile
579785b6cd
fix test pollution in test_assertrewrite
...
originally reproduced with this pollution set:
```
testing/test_assertrewrite.py::TestEarlyRewriteBailout::test_pattern_contains_subdirectories
testing/test_assertrewrite.py::TestRewriteOnImport::test_remember_rewritten_modules
```
2022-02-07 19:29:18 -05:00
pre-commit-ci[bot]
9d2ffe207b
[pre-commit.ci] auto fixes from pre-commit.com hooks
...
for more information, see https://pre-commit.ci
2022-01-31 22:20:16 +00:00
Brett Holman
3f44b4078c
Add test coverage to test rewrite
2022-01-18 11:26:46 -07:00
Hugo van Kemenade
1fd3601caa
Drop support for EOL Python 3.6
2021-12-30 12:37:18 +02:00
Anthony Sottile
c69b84f236
fix typing issues in mypy 0.920
2021-12-21 20:42:32 -05:00
Bruno Oliveira
bd897513f2
Skip TestPyCacheDir.test_sys_pycache_prefix_integration on Windows + Python 3.9
...
Related to #9298
2021-11-19 11:22:08 -03:00
Ran Benita
14a879b6d1
Merge pull request #9183 from bluetech/rm-redundent-osfspath
...
Remove redundant explicit os.fspath calls
2021-10-09 19:14:55 +03:00
Bernát Gábor
3407fe63e2
Support the importlib.resources files API in rewritten files ( #9173 )
2021-10-09 10:54:44 -03:00
Ran Benita
5059b31a73
Remove redundant explicit os.fspath calls
...
Python calls it on its own.
2021-10-09 13:44:44 +03:00
Ran Benita
6a5211f369
rewrite: fixup end_lineno, end_col_offset of rewritten asserts
...
These are new additions in Python 3.8:
https://docs.python.org/3/whatsnew/3.8.html#ast
I'm not sure what's using them but we should set them anyway.
2021-10-05 10:51:09 +03:00
Jakub Kulík
e146aaa2e2
Fix cwd removal on Solaris
2021-08-24 12:11:06 +02:00
Bruno Oliveira
be8d63e33b
Increase truncation threshold with -v, disable with -vv
...
Fix #6682
Fix #8403
2021-03-26 07:05:30 -03:00
Anthony Sottile
7a6ec5616d
clean up mkdtemp usage
...
Committed via https://github.com/asottile/all-repos
2021-03-08 19:12:08 -08:00
Ran Benita
afea190797
Remove some no longer needed type-ignores
2021-01-29 20:40:43 +02:00
Ran Benita
2cb34a99cb
Some py.path.local -> pathlib.Path
2020-12-15 00:29:13 +02:00
Ran Benita
1d532da49e
assertion/rewrite: write pyc's according to PEP-552 on Python>=3.7
...
Python 3.7 changes the pyc format by adding a flags byte. Even though it
is not necessary for us to match it, it is nice to be able to read pyc
files we emit for debugging the rewriter.
Update our custom pyc files to use that format. We write flags==0
meaning we still use the mtime+size format rather the newer hash format.
2020-11-14 23:20:12 +02:00
Ran Benita
531416cc5a
code: simplify Code construction
2020-10-31 12:40:25 +02:00
Christine Mecklenborg
efe470bf1c
Migrate test_assertrewrite.py from testdir to pytester ( #7952 )
2020-10-29 09:54:34 +02:00
Ran Benita
25dee8fef6
testing: fix test_assertrewrite with PYTHONPYCACHEPREFIX
...
Make the tests work when running with PYTHONPYCACHEPREFIX (possible when
running in a dirty environment, not under tox).
2020-10-25 10:11:10 +02:00
Ran Benita
1b23a111d2
Update mypy 0.782 -> 0.790
2020-10-17 19:25:45 +03:00
Anthony Sottile
33d119f71a
py36+: com2ann
2020-10-05 18:33:17 -07:00
Anthony Sottile
66bd44c13a
py36+: pyupgrade: py36+
2020-10-03 12:46:54 -07:00
Anthony Sottile
fb1d550aac
py36+: remove rexport of Path and PurePath
2020-10-03 12:16:52 -07:00
Sorin Sbarnea
b031a7cecf
Smoke tests for assorted plugins ( #7721 )
...
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
Co-authored-by: Kyle Altendorf <sda@fstab.net>
2020-09-19 15:56:52 -03:00
Ran Benita
9ab14c6d9c
typing: set warn_unreachable
...
This makes mypy raise an error whenever it detects code which is
statically unreachable, e.g.
x: int
if isinstance(x, str):
... # Statement is unreachable [unreachable]
This is really neat and finds quite a few logic and typing bugs.
Sometimes the code is intentionally unreachable in terms of types, e.g.
raising TypeError when a function is given an argument with a wrong
type. In these cases a `type: ignore[unreachable]` is needed, but I
think it's a nice code hint.
2020-08-04 09:59:46 +03:00
Ran Benita
b8471aa527
testing: fix some docstring issues
...
In preparation for enforcing some docstring lints.
2020-08-03 10:10:43 +03:00
Ran Benita
a2f021b6f3
Remove no longer needed `noqa: F821` uses
...
Not needed since pyflakes 2.2.0.
2020-07-10 13:08:56 +03:00
Ran Benita
f84ffd9747
Remove unused type: ignores
...
Not needed since update from mypy 0.770 -> 0.780.
2020-06-12 17:34:31 +03:00
Ran Benita
54ad048be7
Enable check_untyped_defs mypy option for testing/ too
2020-06-05 11:34:20 +03:00
Ran Benita
d95132178c
Type annotate _pytest.assertion
2020-06-05 11:34:19 +03:00
Daniel Hahler
18bc706fdc
tests: revisit tests for removed load_module
...
The tests came via c629f6b18
and c61ff31ffa
.
The fixes from there are kind of obsoleted by 4cd08f9
(moving to importlib),
but it makes sense to keep them as integration tests in general.
2020-05-17 14:16:43 -07:00
Ran Benita
46d768503e
Merge pull request #6839 from blueyed/typing-get_dirs_from_args-parseconfig
...
typing: get_dirs_from_args, parseconfig
2020-05-05 21:11:26 +03:00
Bruno Oliveira
80e5098408
Merge pull request #7155 from kerizane/make_numbered_dir
2020-05-03 09:48:36 -03:00
Keri Volans
678440e46d
7018: Use internal version of make_numbered_dir
2020-05-03 10:45:06 +01:00
Ran Benita
409ffcef17
Remove a couple Python 2 __nonzero__ definitions
...
It's called __bool__ in Python 3.
2020-05-01 11:41:21 +03:00
Ran Benita
8fab3dd42f
Remove broken _reprcompare disabling fixture in test_assertrewrite.py
...
The `_pytest._code._reprcompare` that was referred to previously doesn't
exist -- it was moved to other places but wasn't updated. This regressed
in f423ce9c01
. Now we don't want it
anymore, so keep the status quo by explicitly removing them.
2020-04-09 10:47:45 +03:00
Ran Benita
a785754523
Change EnvironmentError, IOError to OSError - they are aliases
...
Since Python 3.3, these are aliases for OSError:
https://docs.python.org/3/whatsnew/3.3.html#pep-3151-reworking-the-os-and-io-exception-hierarchy
2020-03-27 18:40:23 +03:00
Daniel Hahler
8128f4b3b8
Fix test_write_pyc: passed list to parseconfig
2020-02-28 20:40:39 +01:00
Bruno Oliveira
e6ea9edffe
Merge pull request #6673 from sscherfke/features
...
Reverse / fix meaning of "+/-" in error diffs
2020-02-12 15:05:38 -03:00
Ran Benita
d33da078a8
Move ExitCode's definition from _pytest.main to _pytest.config
...
ExitCode is used in several internal modules and hooks and so with type
annotations added, needs to be imported a lot.
_pytest.main, being the entry point, generally sits at the top of the
import tree.
So, it's not great to have ExitCode defined in _pytest.main, because it
will cause a lot of import cycles once type annotations are added (in
fact there is already one, which this change removes).
Move it to _pytest.config instead.
_pytest.main still imports ExitCode, so importing from there still
works, although external users should really be importing from `pytest`.
2020-02-10 23:55:06 +02:00
Stefan Scherfke
d59adc61f9
Reverse / fix meaning of "+/-" in error diffs
...
The convention is "assert result is expected". Pytest's error diffs now
reflect this. "-" means that sth. expected is missing in the result and
"+" means that there are unexpected extras in the result.
Fixes : #3333
2020-02-10 21:12:37 +01:00
Daniel Hahler
5979837c60
Import Path from _pytest.pathlib for py35
...
This is important for `isinstance` checks etc.
2019-11-15 22:19:53 +01:00
Daniel Hahler
45c4a8fb3d
Use atomicrewrites only on Windows
...
Fixes https://github.com/pytest-dev/pytest/issues/6147
2019-11-07 20:57:45 +01:00
MarcoGorelli
d863c30c74
Fix plurality mismatch for and in pytest terminal summary
2019-10-27 15:16:24 +00:00
Bruno Oliveira
6f20b4b014
Introduce compat.fspath
2019-10-26 10:37:44 -03:00
Bruno Oliveira
f93f284356
Support sys.pycache_prefix on py38
...
Fix #4730
2019-10-26 10:17:21 -03:00