Commit Graph

243 Commits

Author SHA1 Message Date
Bruno Oliveira 1d451c786d
Merge pull request #3509 from nicoddemus/marshal-3503
Write rewritten code using file.write(marshal.dumps())
2018-05-25 21:24:45 -03:00
Bruno Oliveira b5a94d8e6c Write rewritten code using file.write(marshal.dumps())
This works around the fact that some libraries might monkey patch
the file object, so the previous approach of marshal.dump(co, file)
breaks because file is not a built-in file object anymore.

Fix #3503
2018-05-25 17:24:23 -03:00
Ronny Pfannschmidt 703e4b11ba run black 2018-05-23 16:48:46 +02:00
Ronny Pfannschmidt 9aacb4635e run pyupgrade 2018-05-23 16:45:09 +02:00
Bruno Oliveira 674879976f Merge remote-tracking branch 'upstream/master' into merge-master-into-features 2018-05-18 12:30:08 -03:00
Bruno Oliveira 413b1aa4e9
Rename internal function as suggested during review 2018-05-04 11:08:35 -03:00
Bruno Oliveira dca77b2273 Escape whitespace only strings when diffing them on failed assertions
Fix #3443
2018-05-03 20:38:00 -03:00
Bruno Oliveira aa95a425d7 Attempt to solve race-condition which corrupts .pyc files on Windows
This uses of the `atomicwrites` library.

This is very hard to create a reliable test for.

Fix #3008
2018-04-12 08:19:28 -03:00
Bruno Oliveira 8ca9321940 Move compatibility imports to compat.py and fix linting 2018-03-29 19:02:35 -03:00
Irmen de Jong faded25ee8 chage collections.abc import to fix deprecation warnings on python 3.7 2018-03-29 20:02:00 +02:00
Bruno Oliveira af37778b0d All classes now subclass object for better py3 compatibility
Fix #2147
2018-01-24 18:23:42 -02:00
Antony Lee 45e7734b1a Change set ops to use methods instead of operators. 2017-12-13 00:54:57 -08:00
Antony Lee c8e7d1ae34 Respect PYTEST_DONT_REWRITE for plugins too. 2017-12-12 17:43:17 -08:00
Srinivas Reddy Thatiparthy fc544dc660 remove redundant checking because
* isinstance([], Sequence) is True

* isinstance((), Sequence) is True
2017-12-12 00:10:59 +05:30
Srinivas Reddy Thatiparthy 7792587b3f remove unnecessary import 2017-12-12 00:03:38 +05:30
Srinivas Reddy Thatiparthy cb0ba18f53 remove '_ast' module; and redirect '_ast' references to 'ast' 2017-12-11 23:14:17 +05:30
Bruno Oliveira 4678cbeb91 Merge remote-tracking branch 'upstream/features' 2017-11-27 19:37:58 -02:00
Daniel Hahler d5f038e29a Fix spelling: s/re-writ/rewrit/g
This also fixes "can not" to "cannot" in the "Module already imported so
cannot be rewritten" assertion error.
2017-11-26 20:46:06 +01:00
Bruno Oliveira f50ace7c0a Merge remote-tracking branch 'upstream/master' into release-3.3.0 2017-11-23 20:20:40 +00:00
Bruno Oliveira c8d52b633b Fix assertion rewrite to match module names correctly
Fix #2939
2017-11-21 23:06:47 -02:00
Bruno Oliveira 983a09a2d4 Merge remote-tracking branch 'upstream/master' into merge-master-into-features 2017-11-10 18:33:02 -02:00
Bruno Oliveira b11640c1eb Fix linting E722: do not use bare except 2017-11-04 13:59:10 -02:00
Bruno Oliveira 03829fde8a Fix linting E741: ambiguous variable name 2017-11-04 13:59:10 -02:00
Bruno Oliveira f3a119c06a Merge upstream/master into features 2017-11-03 16:37:18 -02:00
Sviatoslav Abakumov fd7bfa30d0 Put imports on the last line unless there are other exprs 2017-10-25 11:05:07 +03:00
Sviatoslav Abakumov 3427d27d5a Try to get docstring from module node 2017-10-25 10:54:43 +03:00
hugovk ef732fc51d Remove code for unsupported Python versions 2017-10-10 08:54:56 +03:00
Srinivas Reddy Thatiparthy dc563e4954 convert py module references to six module 2017-08-04 08:05:03 +05:30
Andras Tim b49e8baab3 Fixed E731 flake8 errors
do not assign a lambda expression, use a def
2017-07-17 01:44:23 +02:00
Andras Tim 7248b759e8 Fixed E303 flake8 errors
too many blank lines (3)
2017-07-17 01:44:23 +02:00
Andras Tim b840622819 Fixed E302 flake8 errors
expected 2 blank lines, found 0
2017-07-17 01:44:23 +02:00
Andras Tim 8f3eb6dfc7 Fixed E261 flake8 errors
at least two spaces before inline comment
2017-07-17 01:44:22 +02:00
Andras Tim 617e510b6e Fixed E231 flake8 errors
missing whitespace after ‘,’, ‘;’, or ‘:’
2017-07-17 01:44:22 +02:00
Andras Tim 4b22f270a3 Fixed E226 flake8 errors
missing whitespace around arithmetic operator
2017-07-17 01:44:22 +02:00
Andras Tim 2e8caefcab Fixed E225 flake8 errors
missing whitespace around operator
2017-07-17 01:44:22 +02:00
Andras Tim 1c935db571 Fixed E129 flake8 errors
visually indented line with same indent as next logical line
2017-07-17 01:28:16 +02:00
Andras Tim 57438f3efe Fixed E127 flake8 errors
continuation line over-indented for visual indent
2017-07-17 01:28:16 +02:00
Bruno Oliveira 97367cf773 Remove obsolete comment from rewrite.py
This was made obsolete by 021e843427
2017-06-13 23:12:33 -03:00
Andreas Pelme 021e843427 Fixed #2121 Use `py.path`s fnmatch. This fixes an issue where
python_files handled properly when rewriting assertions.
2017-05-31 08:25:04 +02:00
Bruno Oliveira d86c89e193 Revert refactor of old-style to new-style classes
As discussed in the mailing list, unfortunately this might break APIs
due to the subtle differences between new and old-style classes (see #2398).

This reverts commit d4afa1554b from PR #2179.
2017-05-17 18:20:51 -03:00
Bruno Oliveira 25371ddbfd Merge pull request #2315 from RonnyPfannschmidt/namespace-hook
remove pytest internal usage of the namespace hook
2017-04-21 16:24:20 -03:00
Bruno Oliveira 1b5f898dc5 Ensure rewritten modules don't inherit __future__ flags from pytest
In a recent refactoring we enabled all __future__ features in pytest
modules, but that has the unwanted side effect of propagating those
features to compile()'d modules inside assertion rewriting, unless
we pass dont_inherit=False to compile().
2017-04-06 15:00:36 -03:00
Ronny Pfannschmidt 5818e65cf3 remove pytest_namespace from _pytest/assertion 2017-03-28 11:35:29 +02:00
Bruno Oliveira 42a5d6bdfa Add __future__ imports to all pytest modules
This prevents silly errors from creeping in Python 2 when testing in Python 3
2017-03-16 22:45:40 -03:00
Bruno Oliveira 1e0cf5ce4d Merge remote-tracking branch 'upstream/master' into merge-master-into-features
# Conflicts:
#	AUTHORS
#	CHANGELOG.rst
#	_pytest/pytester.py
2017-03-10 15:54:05 -03:00
Patrick Hayes 58ce3a9e8c Safer sys.modules delete 2017-02-14 16:54:32 -08:00
mandeep d4afa1554b Refactored old style classes to new style classes 2017-01-08 22:52:42 -06:00
Bruno Oliveira 402fbe503a Merge branch 'master' into merge-master-into-features 2016-12-27 23:31:26 -02:00
Bruno Oliveira 7480342710 Fix typo in docstring of register_assert_rewrite 2016-12-02 09:22:47 -02:00
Bruno Oliveira bc0f7e6243 Fix false-positive assert rewrite warnings when using 'pytest_plugins'
pytest would emit false positive warnings about assertion-rewrite when a
module appears multiple times in plugins which depend
on other plugins using the 'pytest_plugins' mechanism
2016-12-01 15:50:08 -02:00