Bruno Oliveira
dc20dedbc7
Change RemovedInPytest4Warnings to errors by default
...
To keep existing tests which emit RemovedInPytest4Warnings running, decided
to go with a command line option because:
* Is harder to integrate an ini option with tests which already use an ini file
* It also marks tests which need to be removed/updated in 4.1, when
RemovedInPytest4Warning and related functionality are removed.
Fix #3737
2018-11-12 16:10:57 -02:00
Daniel Hahler
4a74d455de
minor: typos
2018-11-09 02:03:44 +01:00
Anthony Sottile
2368fbb63c
Apply reorder-python-imports to all files
2018-10-25 00:01:29 -07:00
Bruno Oliveira
b7560a8808
Keep backward compatibility for code as kw in Node.warn
2018-09-04 16:48:21 -03:00
Bruno Oliveira
47bf58d69e
Make Node.warn support two forms, new and deprecated
...
As suggested during review, it now accepts two forms:
Node.warn(warning_instance) (recommended)
Node.warn(code, message) (deprecated)
2018-09-04 15:53:17 -03:00
Bruno Oliveira
78ac7d99f5
Deprecate Config.warn and Node.warn, replaced by standard warnings
2018-09-04 11:35:34 -03:00
Bruno Oliveira
2f2d5861bb
Merge remote-tracking branch 'upstream/master' into merge-master-into-features
2018-08-26 16:45:00 -03:00
Anthony Sottile
85482d575e
Replace Source with dedent where possible
2018-08-23 09:06:17 -07:00
Bruno Oliveira
c64a8c9c7f
Merge remote-tracking branch 'upstream/master' into merge-master-into-features
2018-08-18 15:54:53 -03:00
Virgil Dupras
126896f69d
Add option to disable plugin auto-loading
...
If `PYTEST_DISABLE_PLUGIN_AUTOLOAD` is set, disable auto-loading of
plugins through setuptools entrypoints. Only plugins that have been
explicitly specified are loaded.
ref #3784 .
2018-08-07 13:16:28 -04:00
Bruno Oliveira
2c0d2eef40
Only consider actual functions when considering hooks
...
Fix #3775
2018-08-04 16:37:07 -03:00
Anthony Sottile
cbaa7dd56a
Upgrade pre-commit hooks except pyupgrade
2018-06-26 06:35:27 -07:00
Ronny Pfannschmidt
464117b472
fix imports in tests
2018-06-05 10:20:36 +02: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
feuillemorte
409b919fc0
#3260 Added test
2018-02-27 19:16:45 +03:00
Bruno Oliveira
aff463a3c4
Merge remote-tracking branch 'upstream/master' into features
2018-01-27 12:28:43 -02:00
Bruno Oliveira
3f5e9ea71e
Fix -o behavior to no longer swallow all remaining options
...
The current behavior was too error-prone because a "-o" option would
swallow all the following non-option parameters:
pytest -o foo=bar path/to/test.py
path/to/test.py would be captured by the -o option, and would fail
because "path/to/test.py" is not in the format "key=value".
2018-01-23 21:19:16 -02:00
Bruno Oliveira
8426c57a9e
Ensure changes in the message in the future do not make the test pass by accident
2018-01-23 21:18:59 -02:00
Aron Coyle
203508d9f3
cleanup test cases
2018-01-23 21:18:37 -02:00
Andrew Toolan
2c7f94fdb9
Added basic fix and test
2018-01-23 21:18:10 -02:00
Anthony Sottile
bd1d17e8de
Replace py.std with stdlib imports
2018-01-09 12:44:10 -08:00
Bruno Oliveira
2a75ae46c3
Improve test that blocks setuptools plugins from being loaded
...
Make it a parametrized test to ensure all the mocked mechanisms in
the test actually work as expected when we *do not* use "-p no:"
2017-11-28 21:29:58 -02:00
Roland Puntaier
833f33fa0c
removed comments
2017-11-28 17:38:49 +01:00
Roland Puntaier
6843d45c51
added test for #2920 fix
2017-11-28 17:29:52 +01: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
03829fde8a
Fix linting E741: ambiguous variable name
2017-11-04 13:59:10 -02:00
Bruno Oliveira
10a3b9118b
Use a relative cache_dir in test because of how arguments are parsed on Windows
...
We use shlex to parse command-line arguments and PYTEST_ADDOPTS, so passing
a full path with '\' arguments produces incorrect results on Windows
Anyway users are advised to use relative paths for portability
2017-10-11 19:37:17 -03:00
Dirk Thomas
ce8c829945
add test for #2824
2017-10-11 09:41:18 -07:00
hugovk
ef732fc51d
Remove code for unsupported Python versions
2017-10-10 08:54:56 +03:00
Srinivas Reddy Thatiparthy
a0101f024e
remove os.sep as it behaves differently linux and windows.
...
* on linux it is '/'
* on windows it is '\'
2017-08-05 23:21:43 +05:30
Andras Tim
45ac863069
Fixed E401 flake8 errors
...
multiple imports on one line
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
4730c6d99d
Fixed E272 flake8 errors
...
multiple spaces before keyword
2017-07-17 01:44:23 +02:00
Andras Tim
b226454582
Fixed E251 flake8 errors
...
unexpected spaces around keyword / parameter equals
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
cf97159009
Fixed E128 flake8 errors
...
continuation line under-indented for visual indent
2017-07-17 01:28:16 +02:00
Andras Tim
6af2abdb53
Fixed flake8 warnings
...
W191 indentation contains tabs
W292 no newline at end of file
W293 blank line contains whitespace
W391 blank line at end of file
2017-07-17 01:28:16 +02:00
Bruno Oliveira
fa56114115
Clean up warnings generated by pytest's own suite
2017-03-20 22:13:17 -03:00
Bruno Oliveira
9f85584656
Merge remote-tracking branch 'upstream/features' into integrate-pytest-warnings
2017-03-20 19:59:05 -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
Bruno Oliveira
78194093af
Improve warning representation in terminal plugin and fix tests
2017-03-16 21:57:32 -03:00
Bruno Oliveira
0baed781fe
Merge remote-tracking branch 'upstream/features' into integrate-pytest-warnings
2017-03-16 20:02:06 -03:00
Bruno Oliveira
337f891d78
Fixed tests
2017-03-16 20:01:47 -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
fbjorn
cee578e327
Fix trailing whitespace in terminal output
2017-03-05 23:20:55 +03:00
Michal Wajszczuk
fb0b90646e
New-style classes implemented for python 2.7 - #2147
2017-02-16 20:28:17 +01:00
Bruno Oliveira
9eb1d73951
--override-ini now correctly overrides some fundamental options like "python_files"
...
#2238
2017-02-08 23:03:33 -02:00
Bruno Oliveira
7cd7c283dd
Refactor plugin specs handling into an isolated function
2017-01-12 14:31:35 -02:00
Andreas Pelme
0bb8a4a36d
Fixed #2148 - parse directory names properly when args contains ::.
...
This commit also improves readbility in get_dirs_from_args by using self
documenting local functions.
get_dirs_from_args also now only returns directories that actually exists,
and not files to avoid confusion.
This commit also removes redundant checks in get_common_ancestor that
was already performed in get_dirs_from_args..
2016-12-27 15:28:56 +01:00
Luke Murphy
c856537e71
Add warning for incorrect passing args to `-o`.
2016-12-01 13:20:42 +01:00
Bruno Oliveira
629d8e9fd6
Show an error if --confcutdir is not a valid directory
...
Fixes #2078
2016-11-23 09:49:11 -02: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
Bruno Oliveira
463e6572c5
Merge branch 'master' into merge-master-into-features
...
Preparing for 3.0
2016-08-17 22:39:23 -03:00
Bruno Oliveira
224ef67374
Quick fix for tests in config depended on the current directory
...
When running those tests from pytest's root folder, they would
fail because they would end up picking pytest's own pytest.ini
2016-08-17 21:32:05 -03:00
Bruno Oliveira
ab86dea529
Support [tool:pytest] in setup.cfg files
...
Also deprecate [pytest] usage in setup.cfg files
Fix #567
2016-08-17 08:19:38 -03:00
Daniel Hahler
16cb5d01b1
Fix off-by-one error with lines from request.node.warn
...
The line numbers in `node.location` seem to be zero-based?!
2016-08-14 22:10:01 +02:00
Bruno Oliveira
802755ceed
Merge remote-tracking branch 'upstream/master' into merge-master-into-features
2016-08-06 17:58:17 -03:00
Daniel Hahler
a2891420de
Fix determining rootdir from common_ancestor
2016-08-06 19:35:40 +02:00
Daniel Hahler
5c5d7e05f7
Followup to #1718 : style/formatting
2016-07-24 00:21:42 +02:00
Floris Bruynooghe
24fbbbef1f
Merge pull request #1641 from flub/rewrite-plugins
...
Rewrite plugins
2016-07-14 19:39:15 +01:00
Floris Bruynooghe
51ee7f8734
Fixup things after rebase
...
Some changes to make things work on top of current features branch.
2016-07-14 12:42:29 +01:00
Bruno Oliveira
1266ebec83
Merge remote-tracking branch 'upstream/features' into warnings-displayed-by-default
...
# Conflicts:
# CHANGELOG.rst
# testing/test_terminal.py
2016-07-13 18:45:15 -03: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
aostr
94e4a2dd67
* implemented changes recommended by nicoddemus
2016-07-05 15:22:27 +02:00
RedBeardCode
0e2ebc96ff
Remove deprecated cmd options
...
Fixes #1657
2016-06-26 19:26:04 +02:00
aostr
e04d9ff80b
* now showing pytest warnings summary by default.
...
* added ``--disable-pytest-warnings` flag to let users disable the warnings summary.
* extended/changed unit tests for the changes in the pytest core.
2016-06-25 18:16:13 +02:00
Ted Xiao
856e6cab75
add --override-ini option to overrides ini values
...
Signed-off-by: Ted Xiao <xiao.xj@gmail.com>
2016-06-25 23:45:32 +08:00
Florian Bruhin
757f37f445
Don't ignore ImportError with setuptools plugins
...
This was added in b2d66b9e7b
but is a bad
idea. When a plugin can't be imported, commandline options (optionally
set in pytest.ini) could be undefined, which means pytest bails out
much earlier before showing the warning, which is hard to debug.
Fixes #1479 , also see #1307 and #1497
2016-06-25 09:56:22 +02:00
Bruno Oliveira
4350f499b2
Merge branch 'issue1629' of https://github.com/davehunt/pytest into features
2016-06-21 18:37:14 +02:00
Dave Hunt
ef9dd14963
Introduce pytest command as recommended entry point
...
Fixes #1629
2016-06-21 16:16:57 +02:00
Bruno Oliveira
3a81d2e012
conftest files now use assertion rewriting
...
Fix #1619
2016-06-20 23:13:29 +02:00
MengJueM
1a37035d71
Add test test_absolute_win32_path
2016-04-20 01:27:37 +08:00
Bruno Oliveira
a965386b9e
Add bool type to addini
2016-02-14 20:52:27 -02:00
Bruno Oliveira
a912d3745b
Moved py.code code over to py.test
...
Fix #103
2016-01-25 23:18:04 -02:00
Buck Golemon
67236d6de3
strengthen the ini assertion
2015-10-09 09:58:12 -07:00
Buck Golemon
0e55a8793f
all tests pass
2015-10-09 09:58:12 -07:00
Buck Golemon
49d46a0059
an ugly patch to fix all but the most important part =/
2015-10-08 10:44:58 -07:00
Buck Golemon
616d8251f3
unit tests of Config.fromdictargs. currently failing
2015-10-08 10:44:58 -07:00
Bruno Oliveira
e59471766a
Rename "warnings" to "pytest-warnings" in terminal output
...
Fix #970
2015-08-27 19:59:52 -03:00
Bruno Oliveira
42b43a7d7b
Paths after normal options are now properly used to discover rootdir and ini files
...
Fix #949
2015-08-25 22:08:05 -03:00
Bruno Oliveira
2ffd37b816
return non-zero exit code if no tests are collected
...
Fix #812
Fix #500
2015-08-18 07:35:02 -03:00
Bruno Oliveira
8a6aa5e17e
Print inifile and rootdir when there's usage errors
...
Related to #821
2015-07-10 21:56:12 -03:00
holger krekel
25963e0544
adapt pytest to pluggy's decoratorclass branch
...
--HG--
branch : pluggy1
2015-04-29 16:40:52 +02:00
holger krekel
9aec5cd52d
use runpytest() instead of runpytest_inprocess if a test can run as subprocess as well
...
--HG--
branch : testrefactor
2015-04-28 12:05:08 +02:00
holger krekel
db5649ec6a
streamline pytester API majorly:
...
- integrate conftest into pytester plugin
- introduce runpytest() to either call runpytest_inline (default) or
runpytest_subprocess (python -m pytest)
- move testdir.inline_runsource1 to pdb tests
- strike some unneccessary methods.
- a new section "writing plugins" and some better pytester docs
--HG--
branch : testrefactor
2015-04-28 11:54:53 +02:00
holger krekel
d3e363b97a
- make API between runpytest() and inline_run() more similar
...
- shift a number of tests to become inline_run() tests
--HG--
branch : testrefactor
2015-04-28 11:54:45 +02:00
holger krekel
424e5d1394
make test suite more tolerable against xdist causing warnings itself (which it does
...
currently)
--HG--
branch : plugtestfix
2015-04-27 15:06:47 +02:00
holger krekel
3a1374e69c
simplify plugins bookkeeping further, refine API
...
--HG--
branch : more_plugin
2015-04-25 20:17:32 +02:00
holger krekel
9c5495832c
avoid direct circular reference between config and pluginmanager
...
--HG--
branch : more_plugin
2015-04-25 18:14:41 +02:00
holger krekel
e7a2e53108
Streamline data structures
...
--HG--
branch : more_plugin
2015-04-25 13:38:29 +02:00
holger krekel
02a4042dca
incrementally update hook call lists instead of regenerating the whole
...
list on each registered plugin
--HG--
branch : more_plugin
2015-04-25 11:29:11 +02:00
holger krekel
d73e689991
fix issue616 - conftest visibility fixes. This is achieved by
...
refactoring how nodeid's are constructed. They now are always
relative to the "common rootdir" of a test run which is determined by
finding a common ancestor of all testrun arguments.
--HG--
branch : issue616
2015-02-26 21:56:44 +01:00
Dave Hunt
912c8f0540
Use monkeypatch to set the PYTEST_ADDOPTS environment variable in the test.
...
--HG--
branch : env-addopts
2015-01-29 10:52:01 +00:00
Dave Hunt
7325a5fe2e
Support setting configuration using the PYTEST_ADDOPTS environment variable.
...
--HG--
branch : env-addopts
2015-01-23 20:09:42 +00:00
christian@christian-linux.sarrazin.local
c8264385ea
Implement the "-c" command line switch that allows to explicitly specifiy the config file to load.
...
This feature was requested in issue #174 .
--HG--
branch : explicit-ini-filename
2014-06-27 17:42:37 +02:00
holger krekel
54c88a6cf3
fix flakes issues
2014-06-16 11:27:32 +02:00
holger krekel
d6281b4206
- restore compatibility to old getvalueorskip behaviour
...
- introduce a better NOTSET representation to improve docs
2014-05-14 07:36:31 +02:00