Commit Graph

2085 Commits

Author SHA1 Message Date
Thomas Hisch 2f993af54a Fix context output handling for doctests
Show full context of doctest source in the pytest output, if the lineno of
failed example in the docstring is < 9.
2017-10-29 20:06:10 +00: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
Bruno Oliveira bdab29fa3d Merge pull request #2867 from Perlence/ini-markers-whitespace
Strip whitespace from markers in INI config
2017-10-24 20:11:20 -02:00
Sviatoslav Abakumov 52aadcd7c1 Strip whitespace from markers in INI config
Resolves #2856.
2017-10-24 14:18:39 +03:00
Tom Dalton f5e72d2f5f Unused import / lint 2017-10-24 11:25:42 +01:00
Tom Dalton a5ac19cc5e Merge branch 'issue-2836-fixture-collection-bug' of github.com:tom-dalton-fanduel/pytest into issue-2836-fixture-collection-bug 2017-10-24 10:45:06 +01:00
Tom Dalton 14e3a5fcb9 Move the generic separator to a constant 2017-10-24 10:42:16 +01:00
Bruno Oliveira a3ec3df0c8 Add E722 and E741 flake errors to the ignore list
Also fixed 'E704 multiple statements on one line (def)' in python_api
2017-10-23 18:19:15 -02:00
Tom Dalton 655ab0bf8b Address more review comments, fix massive bug I reintroduced in the node-splitting code :-/ 2017-10-23 17:49:49 +01:00
Tom Dalton a7199fa8ab Docstring typo 2017-10-23 16:59:56 +01:00
Tom Dalton d714c196a5 Shorter code, longer docstring 2017-10-23 16:55:35 +01:00
Tom Dalton ee7e1c94d2 Remove redundant if, tidy if-body 2017-10-23 16:12:07 +01:00
Tom Dalton 1e6dc6f8e5 Working (I think) fix for #2836 2017-10-23 13:26:42 +01:00
Matty G 11b391ff49 Update mark.py 2017-10-17 14:11:07 -07:00
Leonard Lausen e89abe6a40 Defensive fallback in case of kwargs not being present 2017-10-09 00:37:27 +09:00
Leonard Lausen c24ffa3b4c Fix pytest.parametrize when argnames are specified as kwarg 2017-10-08 12:23:26 +09:00
Xuan Luong 7093d8f65e Add example of -k 'not test' in help text 2017-09-30 18:43:20 -04:00
Oliver Bestwalter 2802135741
fix 'DoctestItem' object has no attribute '_fixtureinfo'
* doxtests don't seem to have this attribute, so nothing will be written in that case.
* tried to be a good boy scout and tidied up surrounding code a bit (comments, shadowed/unused names, removed random new lines, naming things)
2017-09-19 12:41:12 +02:00
Bruno Oliveira ac5c5cc1ef Merge pull request #2750 from evanunderscore/fix-filescompleter
Fix crash in FastFilesCompleter with no prefix
2017-09-14 20:11:43 -03:00
Xuan Luong 1e93089165 [bugfix] Checking MarkDecorator equality returns False for non-MarkDecorator object 2017-09-09 01:31:08 -04:00
Evan 6cf515b164 Fix crash in FastFilesCompleter with no prefix 2017-09-08 00:14:56 +10:00
Ronny Pfannschmidt ad36407747 Merge pull request #2700 from nicoddemus/staticmethods-fixtures
Allow tests declared as @staticmethod to use fixtures
2017-09-06 08:24:00 +02:00
Bruno Oliveira 1fc185b640 Add comment about possible future refactoring in the fixture mechanism 2017-09-05 19:28:39 -03:00
Ronny Pfannschmidt 181bd60bf9 Merge pull request #2742 from nicoddemus/resultlog-deprecation
Improve user guidance regarding ``--resultlog`` deprecation
2017-09-01 08:29:41 +02:00
Bruno Oliveira 3288c9a110 Improve user guidance regarding ``--resultlog`` deprecation
Fix #2739
2017-08-31 19:11:41 -03:00
Ronny Pfannschmidt 5e00549ecc Merge pull request #2735 from fgmacedo/fgm-fix-reprfuncargs-toterminal
2731.bug Fix ReprFuncArgs with mixed unicode and utf-8 args.
2017-08-31 09:36:56 +02:00
Fernando Macedo 59cdef92be fixes #2731 ReprFuncArgs with mixed unicode and utf-8 args 2017-08-30 16:06:12 -03:00
Kirill Pinchuk 12b1bff6c5 `compat.safe_getattr` now catches OutcomeExceptions too 2017-08-23 17:17:03 +03:00
Bruno Oliveira a993add783 Allow tests declared as @staticmethod to use fixtures
Fix #2699
2017-08-17 20:44:19 -03:00
Bruno Oliveira f18780ed8a Update docs: ``match`` keyword was introduced in 3.1
Also update the text to recommend using the context-manager
over the callable/string forms.
2017-08-16 14:28:34 -03:00
Andreas Pelme 39331856ed Use the correct stacklevel for getfuncargvalue() deprecation warning.
Fixed #2681.
2017-08-13 14:59:33 +02:00
Bruno Oliveira cc0f2473eb Fix windows console workaround error with non-standard io-streams
Fix #2666
2017-08-07 20:57:13 -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
Bruno Oliveira ad52f714a9 Fix small terminal glitch when collecting a single test item
Fix #2579
2017-08-03 20:57:46 -03:00
Bruno Oliveira 7703dc921c Only skip null bytes before setting the environment variable
As discussed, node ids have already been "ascii" sanitized by the
parametrization process
2017-08-02 10:27:45 -03:00
Bruno Oliveira 1deac2e210 Properly escape test names when setting PYTEST_CURRENT_TEST environment variable
Fix #2644
2017-08-01 20:52:37 -03:00
Bruno Oliveira 763c580a2a Merge pull request #2576 from maiksensi/feat/raise-not-implemented-for-lt-gt-in-approx
#2003 Change behavior of `approx.py` to only support `__eq__` comparison
2017-07-30 17:48:33 -03:00
Bruno Oliveira e1aed8cb17 Merge pull request #2490 from RonnyPfannschmidt/fix-580
Test Outcomes as BaseException - fix #580
2017-07-30 17:38:42 -03:00
Bruno Oliveira 713f7636e1 Merge pull request #2632 from jmoldow/pep_0415_suppress_exception_context
Support PEP-415's Exception.__suppress_context__
2017-07-30 17:22:40 -03:00
Bruno Oliveira 4cd8727379 Merge pull request #2617 from wence-/fix/nondeterministic-fixtures
Fix nondeterminism in fixture collection order
2017-07-30 17:17:40 -03:00
Jordan Moldow 2e61f702c0 Support PEP-415's Exception.__suppress_context__
PEP-415 states that `exception.__context__` should be suppressed
in traceback outputs, if `exception.__suppress_context__` is
`True`.

Now if a ``raise exception from None`` is caught by pytest,
pytest will no longer chain the context in the test report.

The algorithm in `FormattedExcinfo` now better matches the one
in `traceback.TracebackException`.

`Exception.__suppress_context__` is available in all of the
versions of Python 3 that are supported by pytest.

Fixes #2631.
2017-07-29 02:39:17 -07:00
Ronny Pfannschmidt be401bc2f8 fix linting issues 2017-07-28 18:27:59 +02:00
Ronny Pfannschmidt 06a49338b2 make Test Outcomes inherit from BaseException instead of exception
fixes #580
2017-07-28 15:28:51 +02:00
Bruno Oliveira 7a12acb6a1 Fix linting 2017-07-28 08:54:55 -03:00
Bruno Oliveira 5acb64be90 Add versionadded tag to pytest_report_collectionfinish hook 2017-07-28 08:54:55 -03:00
Bruno Oliveira 75e6f7717c Use new hook to report accurate tests skipped in --lf and --ff 2017-07-28 08:54:55 -03:00
Bruno Oliveira eb1bd3449e xfail and skipped tests are removed from the "last-failed" cache
This accommodates the case where a failing test is marked as
skipped/failed later
2017-07-27 18:43:04 -03:00
Bruno Oliveira 62810f61b2 Make cache plugin always remember failed tests 2017-07-27 14:40:21 -03:00
Bruno Oliveira 17c544e793 Introduce new pytest_report_collectionfinish hook
Fix #2622
2017-07-27 10:44:29 -03:00