Marc Mueller
7259e8db98
Fix assert rewriting with assignment expressions ( #11414 )
...
Fixes #11239
2023-09-09 09:09:31 -03:00
Reagan Lee
d1722d5c18
fix test for codecov
2023-08-21 15:49:39 -07:00
Reagan Lee
61133ba83d
un-iterable fix
2023-08-20 14:46:09 -07:00
Reagan Lee
049eec8474
Revert iter raises checks
...
This reverts commit e938580257
.
Revert "improve error msg and test"
This reverts commit c0cf822ca1
.
Revert "error msg"
This reverts commit ec1053cc16
.
Revert "changelog"
This reverts commit d2dc8a70b5
.
Revert "simplify code / take out user-gen typeerror case"
This reverts commit b9cb87d862
.
2023-08-20 14:06:42 -07:00
Reagan Lee
c0cf822ca1
improve error msg and test
2023-08-11 10:33:34 -07:00
Reagan Lee
b9cb87d862
simplify code / take out user-gen typeerror case
2023-08-10 17:43:01 -07:00
Reagan Lee
47c0fc3d78
tests
2023-08-10 16:36:22 -07:00
Zac Hatfield-Dodds
cb732f7f49
Merge branch 'main' into patch-1
2023-07-04 10:17:06 -07:00
Zac Hatfield-Dodds
f4e3b4ad98
Drop Python 3.7
2023-06-30 14:55:42 -07:00
Tushar Sadhwani
a14fc10cac
add a test function to the test
2023-06-26 13:06:11 +05:30
Tushar Sadhwani
05d7e60904
Add test
2023-06-26 12:37:23 +05:30
Zac Hatfield-Dodds
661b938fca
Add encoding in more tests
2023-06-20 04:55:40 -07:00
nondescryptid
a704605cf1
Fix encoding warnings
2023-06-20 04:55:39 -07:00
Alessio Izzo
9e1add75f7
Fix warlus operator behavior when called by a function ( #11041 )
...
In #10758 we introduced the support for the use of the walrus operator in the test cases. There was a case which was not handled that caused a bug report #11028 . This PR aims to fix the issue and also to improve how the walrus operator is handled in the AssertionRewriter class.
Closes #11028
2023-05-30 11:59:24 -03:00
Alessio Izzo
6e478b0947
Fix walrus operator support in assertion rewriting ( #10758 )
...
Closes #10743
2023-03-10 07:32:36 -03:00
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