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
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
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
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
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
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
Patrick Hayes
58ce3a9e8c
Safer sys.modules delete
2017-02-14 16:54:32 -08: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
Ronny Pfannschmidt
a5b5090c72
Merge pull request #2070 from nedbat/bug2038
...
Don't fail if imp can't find the source for a .pyc file. #2038
2016-11-22 17:45:29 +01:00
Bruno Oliveira
1eb5a690d4
Fix flake8 E305 and E306 errors
...
These errors started to appear with flake8-3.1.1, while they don't appear with
version 3.1.0 (weird).
2016-11-20 18:59:15 -02:00
Ned Batchelder
06bb61bbe3
Don't fail if imp can't find the source for a .pyc file. #2038
2016-11-20 13:09:32 -05:00
Bruno Oliveira
2a2b8cee09
Fix false-positive warnings from assertion rewrite hook
...
Fix #2005
2016-10-20 21:40:57 -02:00
Bruno Oliveira
6711b1d6ab
Rewrite asserts in test-modules loaded very early in the startup
...
Also now match modules which start with any of the names registered
using register_assert_rewrite as discussed in #1787
Fix #1784
2016-08-03 12:49:48 -03:00
Floris Bruynooghe
743f59afb2
Introduce pytest.register_assert_rewrite()
...
Plugins can now explicitly mark modules to be re-written. By default
only the modules containing the plugin entrypoint are re-written.
2016-07-13 17:31:09 +01:00
Floris Bruynooghe
944da5b98a
Avoid rewrite warning for inline runs
...
When running pytest inline/inprocess we plugins have already been
imported and re-writen, so avoid the warning.
2016-07-13 17:29:19 +01:00
Floris Bruynooghe
a98e3cefc5
Enable re-writing of setuptools-installed plugins
...
Hook up the PEP 302 import hook very early in pytest startup so
that it gets installed before setuptools-installed plugins are
imported. Also iterate over all installed plugins and mark them
for rewriting. If an installed plugin is already imported then
a warning is issued, we can not break since that might break
existing plugins and the fallback will still be gracefull to
plain asserts.
Some existing tests are failing in this commit because of the new
warning triggered by inline pytest runs due to the hypothesis
plugin already being imported. The tests will be fixed in the next
commit.
2016-07-13 17:29:19 +01:00
Ronny Pfannschmidt
b9a91dc112
merge from master to features
2016-07-06 11:51:48 +02:00
Bruno Oliveira
58e558141d
Remove commented out code
2016-06-26 21:19:07 +02:00
Vasily Kuznetsov
c17027e576
Warn about asserts on tuples ( fixes #1562 )
2016-06-25 19:21:48 +02:00
RedBeardCode
e2f550156e
Improve of the test output for logical expression with brackets.
...
Fixes #925
2016-06-25 18:10:36 +02:00
Bruno Oliveira
819942e964
Return explicit None from rewrite hook's find_module
2016-06-21 12:28:36 +02:00
Floris Bruynooghe
9118c0222f
Merge .set_config() into constructor
2016-06-21 09:28:10 +02:00
Bruno Oliveira
3a81d2e012
conftest files now use assertion rewriting
...
Fix #1619
2016-06-20 23:13:29 +02:00
TomV
7d107018e8
Fix #1290 : Py3.5's @ operator/assertion rewriting.
2016-02-05 23:09:57 +00:00
Florian Bruhin
2956627b8b
Handle EPERM when writing rewritten bytecode.
...
Fixes #1143 .
2015-10-17 11:55:55 +02:00
Thomas Kluyver
4462b83258
Style fix
2015-07-16 11:04:36 -07:00
Thomas Kluyver
195422f9c0
Fix AST rewriting with starred expressions in function calls
2015-07-15 15:31:35 -07:00
Matthias Bussonnier
167625d24d
simplify + fix
2015-07-15 13:49:40 -07:00
Matthias Bussonnier
26e64fc45c
Ast Call signature changed on 3.5
...
fix issue 744 on bitbucket
port of merge request 296
https://bitbucket.org/pytest-dev/pytest/pull-request/296/astcall-signature-changed-on-35
https://bitbucket.org/pytest-dev/pytest/issue/744/
2015-07-15 13:49:40 -07:00
Bruno Oliveira
7445c5bd70
Add support for PEP302 get_data API
...
Fix #808
2015-07-11 14:13:43 -03:00