Commit Graph

186 Commits

Author SHA1 Message Date
Ronny Pfannschmidt 2b92fee1c3 initial conversion of exit codes to enum 2019-06-15 06:48:00 +02:00
Anthony Sottile 4df529e5b9 Clean up __future__ and coding: in tests 2019-06-03 12:08:02 -03:00
Anthony Sottile a91fe1fedd pre-commit run pyupgrade --all-files 2019-06-03 12:08:02 -03:00
Anthony Sottile 3f1ec520fc pre-commit run reorder-python-imports --all-files 2019-06-03 12:08:01 -03:00
Anthony Sottile 5034399d7a pre-commit run fix-encoding-pragma --all-files 2019-06-03 12:08:01 -03:00
Bruno Oliveira 4d49ba6529 Drop Python 2.7 and 3.4 support
* Update setup.py requires and classifiers
* Drop Python 2.7 and 3.4 from CI
* Update docs dropping 2.7 and 3.4 support
* Fix mock imports and remove tests related to pypi's mock module
* Add py27 and 34 support docs to the sidebar
* Remove usage of six from tmpdir
* Remove six.PY* code blocks
* Remove sys.version_info related code
* Cleanup compat
* Remove obsolete safe_str
* Remove obsolete __unicode__ methods
* Remove compat.PY35 and compat.PY36: not really needed anymore
* Remove unused UNICODE_TYPES
* Remove Jython specific code
* Remove some Python 2 references from docs

Related to #5275
2019-06-02 14:39:11 -03:00
Anthony Sottile cafb13c95f Fix `pytest.mark.parametrize` when the argvalue is an iterator 2019-06-01 15:09:17 -07:00
Anthony Sottile dc75b6af47 Use fix-encoding-pragma pre-commit hook 2019-05-14 15:56:31 -07:00
Bruno Oliveira 0594dba5ce Remove unused markers and enable --strict-markers 2019-05-09 19:36:39 -03:00
Bruno Oliveira f1183c2422 Remove the 'issue' marker from test suite
It doesn't seem to add much value (why would one execute tests
based on that marker?), plus using the docstring for that
encourages one to write a more descriptive message about the test
2019-05-09 19:36:38 -03:00
Bruno Oliveira 685ca96c71 Change ``--strict`` to ``--strict-markers``, preserving the old one
Fix #5023
2019-05-09 19:36:38 -03:00
Daniel Hahler 45ba736c81
Merge pull request #5128 from blueyed/mark-is
Fix error message with unregistered markers
2019-04-15 16:23:54 +02:00
Daniel Hahler cc005af47e Fix error message with unregistered markers 2019-04-15 10:15:37 +02:00
Daniel Hahler 6f0a5789fb Merge master into features 2019-04-14 23:22:21 +02:00
Anthony Sottile 43e7401c91 Produce a warning when unknown arguments are passed to pytest.param() 2019-04-12 13:00:39 -07:00
Zac-HD 00810b9b2a Register "issue" mark for self-tests 2019-03-31 14:22:30 +11:00
Daniel Hahler 76c70cbf4c Fix off-by-one error with lineno in mark collection error 2019-03-27 17:44:52 +01:00
Ronny Pfannschmidt f28b834426 fix #4649 - also transfer markers to keywordmapping
as it turns out it is distinct from nodekeywords and behaves completely different
2019-01-18 23:18:51 +01:00
Ronny Pfannschmidt 9f9f6ee48b remove most of markertransfer
keywords are still a big issue
2018-12-21 14:02:38 +01:00
Bruno Oliveira c378cb4793 Remove support for applying marks to values in parametrize
Fix #3082
2018-12-20 16:16:13 -02:00
Bruno Oliveira 33b877cc01 Merge remote-tracking branch 'upstream/master' into merge-master-into-features 2018-11-23 23:27:41 -02:00
Anthony Sottile b3700f61ba Fix formatting of print() calls 2018-11-22 00:15:14 -08:00
Anthony Sottile 8395b9e25d Require id=... to be a string
This was documented before, but never enforced.  Passing non-strings could
have strange side-effects and enforcing a string simplifies other
implementation.
2018-11-19 11:03:52 -08:00
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
Anthony Sottile 2368fbb63c Apply reorder-python-imports to all files 2018-10-25 00:01:29 -07:00
Bruno Oliveira 5436e42990 Use pytest.fail(..., pytrace=False) when treating user errors
This prevents an enormous and often useless stack trace from showing
to end users.

Fix #3867
Fix #2293
2018-10-10 19:16:53 -03:00
Bruno Oliveira 1101a20408 Merge remote-tracking branch 'upstream/master' into merge-master-into-features 2018-10-02 18:13:54 -03:00
Ronny Pfannschmidt 5d2d64c190
Merge pull request #4057 from jeffreyrack/4051-improve-error-messaging
Improve error messaging when invalid syntax is passed to the -m option
2018-10-01 07:16:59 +02:00
Jeffrey Rackauckas c2179c3127 Improve error messaging when invalid syntax is passed to the -m option 2018-09-30 18:34:56 -07:00
Andrea Cimatoribus 05155e4db0 Fail at parametrize option for empty parameter set
Optionally raise an exception when parametrize collects no arguments.
Provide the name of the test causing the failure in the exception
message.

See: #3849
2018-09-15 09:18:03 +02:00
Bruno Oliveira ddb308455a Make sure warn is called in test_parameterset_extractfrom 2018-09-05 09:01:29 -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 b42518acd5 Change std_warn to receive a single warning instance, addressed review suggestions 2018-09-04 14:20:42 -03:00
Bruno Oliveira 19a01c9849 Make PytestWarning and RemovedInPytest4Warning part of the public API 2018-09-04 11:35:34 -03:00
Bruno Oliveira 0100f61b62 Start the laywork to capture standard warnings 2018-09-04 11:35:15 -03:00
Bruno Oliveira 7696d5371a Merge remote-tracking branch 'upstream/master' into features 2018-07-04 18:49:35 -03:00
Ronny Pfannschmidt 5bd5b8c68a fix #3631 - don't store legacy markinfo when its impossible 2018-06-29 14:01:20 +02:00
Ronny Pfannschmidt 3c73d6298a merge from master to features 2018-06-28 17:32:41 +02:00
Ronny Pfannschmidt b8486037d3 fix #3605 - unpack markdecorators from parameterization 2018-06-26 21:57:31 +02:00
Ronny Pfannschmidt 78a82c05ef consistent failure on all python versions for test_markers_from_parametrize 2018-06-26 21:57:31 +02:00
Ronny Pfannschmidt 853975d93b add failing test for #3605 2018-06-26 21:57:31 +02:00
Ronny Pfannschmidt 89e0a3ec27 merge from master to features 2018-06-26 17:01:05 +02:00
Anthony Sottile cbaa7dd56a Upgrade pre-commit hooks except pyupgrade 2018-06-26 06:35:27 -07:00
Ondřej Súkup deff54aae0
Try import mock, but on python 3.3+ can use also stdlib unittest.mock
From Python 3.3 is mock part of python standard library in unittest namespace
2018-06-23 23:27:07 +02:00
Ronny Pfannschmidt eb0c6a8287 fix addmarker - extract mark from markdecorator 2018-06-13 17:27:00 +02:00
Ronny Pfannschmidt 37793d4cdb fix addmarker - extract mark from markdecorator 2018-06-12 15:50:58 +02:00
Ronny Pfannschmidt 703e4b11ba run black 2018-05-23 16:48:46 +02:00
Ronny Pfannschmidt 3e1590bcfc sort out pyupgrade fallout 2018-05-23 16:45:58 +02:00
Ronny Pfannschmidt 9aacb4635e run pyupgrade 2018-05-23 16:45:09 +02:00
Ronny Pfannschmidt 4914135fdf introduce name filtering for marker iteration again 2018-05-11 21:48:15 +02:00
Ronny Pfannschmidt e6a86e0f4c add tests for #3441 2018-05-03 17:33:59 +02:00
Ronny Pfannschmidt a5cf55dd4a fix test_mark_option_custom - it used the legacy keyword storage for addign markers 2018-05-03 16:33:16 +02:00
Ronny Pfannschmidt dbb1b5a227 remove NodeMarkers, turn own_markers into a list and use iter_markers api exclusively 2018-03-29 18:24:10 +02:00
Ronny Pfannschmidt 159ea9b7c0 turn Markinfo into atts clsas, and return correct instances of it from node.get_marker 2018-03-29 17:52:01 +02:00
Ronny Pfannschmidt 180ae09202 deprecate markinfo and fix up most marker scoping access while completely breaking metafunc testing 2018-03-29 17:52:01 +02:00
Ronny Pfannschmidt f1a1695aaa enable deep merging test - new structure fixed it 2018-03-29 17:52:01 +02:00
Ronny Pfannschmidt 2707221559 port mark evaluation to the new storage and fix a bug in evaluation 2018-03-29 17:52:01 +02:00
Ronny Pfannschmidt 17a1ed5edf use a constant to sort out repeated use of the EMPTY_PARAMETERSET_OPTION 2018-01-26 12:12:26 +01:00
Ronny Pfannschmidt a54cd4c2fd correct testing and usage of the empty_parameter_set_mark config option 2018-01-26 12:05:52 +01:00
Ronny Pfannschmidt d4c11e58aa exted empty parameterset check with reason test 2018-01-26 11:18:50 +01:00
Ronny Pfannschmidt 37b41de779 fix #2527 - introduce a option to pic the empty parameterset action 2018-01-26 11:10:00 +01:00
feuillemorte 8433e2ba04 #2953 fix comments: fix exception type 2018-01-16 23:35:57 +03:00
feuillemorte 076fb56f85 show a simple and easy error when keyword expressions trigger a syntax error 2018-01-16 21:30:44 +03:00
Bruno Oliveira 05cfdcc8cb Revert making TerminalWriter public in TerminalReporter plugin
We eventually want to replace py.io.TerminalWriter (exposed as
"_tw" in TerminalReporter) by something else, so deprecating access
to "_tw" and making it public as "writer" is contrary to that.
2017-11-23 19:53:12 -02:00
Sviatoslav Abakumov 5e71ffab87 Handle marks without description 2017-11-22 15:47:15 +03:00
Bruno Oliveira 03829fde8a Fix linting E741: ambiguous variable name 2017-11-04 13:59:10 -02:00
Sviatoslav Abakumov 52aadcd7c1 Strip whitespace from markers in INI config
Resolves #2856.
2017-10-24 14:18:39 +03:00
Leonard Lausen e86ba41a32 Add testcase for #2819 2017-10-09 01:06:25 +09:00
Xuan Luong 1e93089165 [bugfix] Checking MarkDecorator equality returns False for non-MarkDecorator object 2017-09-09 01:31:08 -04:00
Bruno Oliveira 0726d9a09f Turn warnings into errors in pytest's own test suite
Fix #2588
2017-07-22 21:44:18 -03:00
Ronny Pfannschmidt 65b2de13a3 fix #2540, introduce mark.with_args 2017-07-21 13:37:09 +02:00
Bruno Oliveira 7b1870a94e Fix flake8 in features branch 2017-07-17 21:16:14 -03:00
Bruno Oliveira 4fd92ef9ba Merge branch 'fix-flake8-issues' into features 2017-07-17 21:05:39 -03: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 617e510b6e Fixed E231 flake8 errors
missing whitespace after ‘,’, ‘;’, or ‘:’
2017-07-17 01:44:22 +02:00
Andras Tim df54bf0db5 Fixed E131 flake8 errors
continuation line unaligned for hanging indent
2017-07-17 01:28:16 +02:00
Andras Tim e855a79dd4 Fixed E126 flake8 errors
continuation line over-indented for hanging indent
2017-07-17 01:28:16 +02:00
Ronny Pfannschmidt 19b12b22e7 store pristine marks on function.pytestmark
fixes #2516
2017-06-22 10:48:45 +02:00
Bruno Oliveira f3b359f5b8 Merge remote-tracking branch 'upstream/master' into merge-master-into-features
# Conflicts:
#	_pytest/capture.py
#	_pytest/compat.py
#	_pytest/python.py
#	testing/python/collect.py
#	testing/test_mark.py
2017-05-03 19:04:53 -03:00
Vitaly Lashmanov 60b8339166 Issue #2383 - Show the correct error message when collect "parametrize" func with wrong args and add test for this case. 2017-04-29 14:32:09 +03:00
Ronny Pfannschmidt e368fb4b29 implement pytest.param
this allows a clear addition of parameterization parameters that carry along marks
instead of nesting multiple mark objects and destroying the possibility of creating
function valued parameters,
it just folders everything together into one object carrfying parameters, and the marks.
2017-03-17 16:53:43 +01:00
Bruno Oliveira e5021dc9dc Replace py.builtin.print_() calls by builtin print() function 2017-03-16 22:46:51 -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
Michal Wajszczuk fb0b90646e New-style classes implemented for python 2.7 - #2147 2017-02-16 20:28:17 +01:00
Bruno Oliveira 5ce551e469 Merge pull request #2075 from pytest-dev/master
Merge master into features after fixing flake8 errors
2016-11-22 14:10:31 -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
Ronny Pfannschmidt 10094a3f09 use consistent inner repressentation for marks 2016-09-08 09:52:22 +02:00
Bruno Oliveira 458ecae1df Replace all usages of "pytest_funcarg__" for @pytest.fixture 2016-07-11 22:21:52 -03:00
Ronny Pfannschmidt 76756c0c0b mark tests: use better name of the test for #568 2016-06-27 11:57:21 +02:00
Ronny Pfannschmidt 95b83958f4 add xfailing test for issue #568 2016-06-25 15:49:23 +02:00
Ronny Pfannschmidt ec5e05834f fix typo 2016-05-18 21:35:31 +02:00
Ronny Pfannschmidt 98dd2ce75c document reason for #1540 2016-04-28 16:22:31 +02:00
Ronny Pfannschmidt 308e76e19c add xfailing test for #1540 2016-04-28 16:11:30 +02:00
palaviv 1ee3d40dbe allow parametrized nodes to be specified from command line 2016-03-13 23:37:21 +02:00
Bruno Oliveira af893aab26 Remove code related to support python <= 2.5
Fix #1226
2015-12-16 16:16:22 -02:00
jakubo e8f4819876 Test file run twice fails if it contains marked class #683 2015-07-26 12:15:29 +02:00
Anatoly Bubenkov 6af7172204 Merge branch 'pytest-2.7' 2015-07-19 15:25:04 +02:00
Bruno Oliveira aa25fb05a9 Make sure marks in subclasses don't change marks in superclasses
Fix #842
2015-07-16 19:29:16 -03:00
holger krekel bddc88f09e adapt to pluggy naming, rename pytest.hookspec_opts to pytest.hookspec,s ame with hookimpl_opts
--HG--
branch : pluggy1
2015-05-06 10:08:08 +02:00