Commit Graph

1701 Commits

Author SHA1 Message Date
Bruno Oliveira 4ed412eb59 unittest's unexpectedSuccess should work as non-strict xpass
Make sure tests for that behavior obtain the same return code
using either pytest or unittest to run the same file
2016-08-17 21:32:04 -03:00
Raphael Pierzina dfc659f781 Fix sys.version_info expression in xfail marker 2016-08-17 23:32:56 +01:00
Raphael Pierzina 0173952961 Fix py3 xfail expression evaluation and parametrize strict 2016-08-17 23:15:14 +01:00
Raphael Pierzina 767c28d422 Fix broken test in test_junitxml 2016-08-17 22:32:27 +01:00
Raphael Pierzina d1f2f779ee Use a better xfail reason 2016-08-17 22:31:56 +01:00
Raphael Pierzina bb3d6d87b6 Merge branch 'master' into fix-report-outcome-for-xpass 2016-08-17 22:15:29 +01:00
Raphael Pierzina 018197d72a Fix broken test in test_skipping and add one for strict xfail 2016-08-17 22:14:51 +01:00
Raphael Pierzina ea379e0e4f Fix test in test_junitxml and add one for strict 2016-08-17 22:02:54 +01:00
Florian Bruhin 789e4670e7 Merge pull request #1813 from nicoddemus/pytest-setup.cfg
Support [tool:pytest] in setup.cfg files
2016-08-17 20:33:57 +02:00
Florian Bruhin c8ab79402c Merge pull request #1811 from nicoddemus/revert-invocation-fixtures
Revert invocation-fixtures code
2016-08-17 20:32:54 +02: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
Bruno Oliveira 707b6b5e3f Revert all invocation-fixtures code
Due to a serious regression found in #1794, it was decided to pull off
invocation features from 3.0 so it can be (hopefully) re-introduced
in 3.1
2016-08-17 08:12:55 -03:00
Bruno Oliveira f25771a101 Deprecate --resultlog cmdline option
Fix #830
2016-08-16 21:40:34 -03:00
Raphael Pierzina 55ec1d7f56 Update test_junitxml.py to interpret XPASS as passed 2016-08-15 23:58:16 +01:00
Bruno Oliveira ca5957932b Merge pull request #1806 from blueyed/fix-off-by-one-error-with-warnings
Fix off-by-one error with lines from request.node.warn
2016-08-15 19:04:00 -03:00
Daniel Hahler c163cc7937 Improve display of continuation lines with multiline errors
Fixes https://github.com/pytest-dev/pytest/issues/717.
Follow-up to https://github.com/pytest-dev/pytest/pull/1762.
2016-08-14 22:34:31 +02: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
Daniel Hahler 5b95ee3c19 Pass exitstatus to pytest_terminal_summary hook
This is useful to know if a testrun has been interrupted
(EXIT_INTERRUPTED).
2016-08-14 22:06:35 +02:00
Raphael Pierzina 14a4dd0697 Extend test to verify longrepr in stdout 2016-08-12 23:31:38 +01:00
Raphael Pierzina 10a6ed1707 Update unittest test to expect failure for an unexpected success 2016-08-12 23:18:02 +01:00
Christian Boelsen e4028b4505 Fix #1798 to include errors in total tests in junit xml output. 2016-08-08 13:35:49 +01:00
Floris Bruynooghe 99a4a1a784 Merge pull request #1791 from nicoddemus/ide-integration-1790
Internal adjustments for easier integration with IDEs
2016-08-07 23:50:50 +01: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
Bruno Oliveira 1a79137d04 Add originalname attribute to Function
Related to #1790
2016-08-03 22:56:12 -03:00
Bruno Oliveira ff296fd541 Add capstdout and capstderr attrs to TestReport
Related to #1790
2016-08-03 21:49:43 -03:00
Bruno Oliveira 08002ab75a Add longreprtext property to TestReport objects
Related to #1790
2016-08-03 21:49:28 -03: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
Bruno Oliveira 277b6d3974 Sort fixture names when a fixture lookup error occurs 2016-08-02 19:45:31 -03:00
Bruno Oliveira ea6191a0cd Merge pull request #1779 from RonnyPfannschmidt/deselect-no-reason
terminal: dont pretend to know the deselection reason
2016-08-02 08:38:17 -03:00
Ronny Pfannschmidt 48f4e18280 fix deselect tests to match reason removal 2016-08-02 10:43:25 +02:00
Bruno Oliveira 553dc2600f Strip invocation-scope suffix when displaying fixture lookup error 2016-08-01 20:34:56 -03:00
Raphael Pierzina 226f2795ba Merge pull request #1782 from nicoddemus/invocation-fixtures-help
invocation-scoped fixtures show up once with --fixtures
2016-08-01 23:21:28 +01:00
Bruno Oliveira 44ecf2ab2f invocation-scoped fixtures show up once with --fixtures 2016-08-01 18:48:29 -03:00
Bruno Oliveira 31c5194562 Fix broken test in py3k 2016-08-01 18:35:42 -03:00
satoru 3c8222f1db Highlight the path of file location in error report
So that it's more obvious when we need to copy the file path.
2016-08-01 17:42:20 -03:00
Floris Bruynooghe 510a6083ba Merge pull request #1758 from nicoddemus/deprecated-module
Add deprecation module to centralize deprecation messages and bits of…
2016-07-28 22:36:55 +01:00
Bruno Oliveira ed36d627e4 Use PyInstaller for freeze test env
cx_freeze doesn't seem to be very well supported in Python 3.5.

Using pyinstaller instead and rename environment to "freeze" which
is a more generic term for freezing python code into standalone
executables.

Fix #1769
2016-07-26 22:02:37 -03:00
Bruno Oliveira c2864aba3d Merge branch 'master' into merge-master
# Conflicts:
#	AUTHORS
#	CHANGELOG.rst
#	_pytest/monkeypatch.py
#	_pytest/python.py
2016-07-25 19:06:29 -03:00
Bruno Oliveira d911bfcb8a Merge branch 'issue634-scopes' of https://github.com/Stranger6667/pytest
# Conflicts:
#	CHANGELOG.rst
2016-07-25 18:26:50 -03:00
Bruno Oliveira 8f29ce26e9 Merge branch 'mark_missing_fixture_error' of https://github.com/eolo999/pytest 2016-07-25 18:20:17 -03:00
Bruno Oliveira 6c8b0a28e1 Add deprecation module to centralize deprecation messages and bits of code 2016-07-25 18:14:39 -03:00
Dmitry Dygalo d72afe7e08 Fixed scope override inside metafunc.parametrize. Fixes #634 2016-07-25 12:42:50 +02:00
Roberto Polli ab6aef1d1f feature: default behavior now is to ignore duplicate paths specified from the command line. Use --keep-duplicates to retain duplicate paths. 2016-07-25 12:41:58 +02:00
Dmitry Dygalo f7ad173fee Fixed collection of classes with custom ``__new__`` method 2016-07-25 11:33:37 +02:00
Bruno Oliveira a24146dd3c Merge pull request #1757 from tramwaj29/improved-message-when-not-using-parametrized-variable
Improved message when not using parametrized variable
2016-07-24 13:02:03 -03:00
Tom Viner 42adaf5a61 Fix #1210 display msg for early calls to exit 2016-07-24 14:16:34 +02:00
JJ 4aede6faa6 fixed conflicts 2016-07-24 12:10:32 +02:00
JJ d000f2536a added a test for when the indirect is just a string 2016-07-24 10:47:06 +02:00
Daniel Hahler 5c5d7e05f7 Followup to #1718: style/formatting 2016-07-24 00:21:42 +02:00
Edoardo Batini e9a67e6702 Adjust test involving FixtureLookupErrorRepr
I added a starting 'E' to the expected error messages.

The tests were still passing after the previous patch but I think it's
better to have stricter tests.
2016-07-23 23:45:07 +02:00
Diego Russo 1704b7d265 Test case for overriding autouse fixtures
Test case for overriding autouse fixture with a parametrized fixture.
The test covers the problem explained in the issue 1601
Adding Diego Russo to AUTHORS
2016-07-23 16:53:39 +02:00
JJ f26fa5a441 changed error message for unused parametrize name 2016-07-23 16:49:20 +02:00
Romain Dorgueil d5a70acd48 Simplify test in test_doctest_report_none_or_only_first_failure. 2016-07-23 15:58:13 +02:00
Romain Dorgueil e229a27e8b using @pytest.mark.parametrize instead of calling one test many times from another as suggested by @nicoddemus in pr #1754 2016-07-23 15:21:59 +02:00
Romain Dorgueil 1a33025a76 Refactors test to be in its own class, as discussed with @nicoddemus. 2016-07-23 15:16:23 +02:00
Romain Dorgueil fd8e019cc1 Choose the doctest output format in case of failure, still work in progress as a few checks fail (related to #1749) 2016-07-23 14:40:46 +02:00
Bruno Oliveira 05f3422d7c Make monkeypatch invocation-scoped 2016-07-20 22:05:49 -03:00
Bruno Oliveira 4f2bf965cb Merge remote-tracking branch 'upstream/features' into invocation-scoped-fixtures 2016-07-20 21:16:27 -03:00
Bruno Oliveira 6aea164b6d Add more tests for invocation scoped fixtures 2016-07-20 21:02:36 -03:00
Bruno Oliveira e0f08a73ab Merge branch 'features' into conftest-exception-printing 2016-07-20 19:33:36 -03:00
Ronny Pfannschmidt 3fd8257c17 add test for --maxfail=NUM overiding -x 2016-07-20 17:20:10 +02:00
Ronny Pfannschmidt 8a73a2ad60 Merge pull request #1734 from nicoddemus/issue-1728-inconsistent-setup-teardown
setup_* and teardown_* functions argument now optional
2016-07-15 14:59:22 +02:00
Bruno Oliveira ff8fb4950e setup_* and teardown_* functions argument now optional
setup_module, setup_function and setup_method
extra argument are now optional and may be omitted.

Fix #1728
2016-07-14 23:41:40 -03:00
Floris Bruynooghe d1852a48b7 Remove assertion reinterpretation
The assertion reinterpretation is an old backwards compatibility
mode which was no longer being maintained on feature-parity with
the assertion rewriting mode.  It was also responsible for some
dubious patching of builtins and test with side-effects would
suddenly start passing.  Since re-writing has been the default for
a long time and plugins are now also re-written it is time to
retire reinterpretation.
2016-07-15 00:33:39 +01:00
Bruno Oliveira 3328cd2620 Make assert in test_str_args_deprecated more resilient
This attempts to fix CI which broke because of this test.

Other warnings introduced in the future could break
this test.
2016-07-14 18:37:59 -03:00
Bruno Oliveira 350ebc9167 Merge pull request #1730 from RedBeardCode/pytest-1536
Added confcutdir in testing/test_conftest.py::test_conftest_import_or…
2016-07-14 17:02:58 -03:00
Floris Bruynooghe 24fbbbef1f Merge pull request #1641 from flub/rewrite-plugins
Rewrite plugins
2016-07-14 19:39:15 +01:00
RedBeardCode 22bb43413f Added confcutdir in testing/test_conftest.py::test_conftest_import_order and
testing/python/fixture.py::TestAutouseManagement::()::
  test_class_function_parametrization_finalization to avoid problems with
  abandoned conftest.py files in /tmp dir.
  Fixes #1536
2016-07-14 18:15:38 +02: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 ab0b6faa5f Deprecate support for passing command-line as string to pytest.main()
Fixes #1723
2016-07-14 08:11:43 -03: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
Daniel Hahler 3cfebdd7c5 funcarg_prefix_warning: remove newline
Followup to https://github.com/pytest-dev/pytest/pull/1718.
2016-07-13 18:33:24 +02: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 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 c4f20a1834 Merge pull request #1712 from anntzer/custom-debugger
Allow passing a custom Pdb subclass via --pdbcls.
2016-07-12 16:45:07 +02:00
Antony Lee 7ee3dd1cb5 Add tests for custom pdb class.
(and edit CHANGELOG)
2016-07-11 20:07:29 -07:00
Bruno Oliveira 458ecae1df Replace all usages of "pytest_funcarg__" for @pytest.fixture 2016-07-11 22:21:52 -03:00
Bruno Oliveira ad4125dc0d Deprecate "pytest_funcarg__" prefix to declare fixtures
Fixes #1684
2016-07-11 22:21:50 -03:00
Bruno Oliveira 5506dc700c Deprecate yield tests
Closes #16
Closes #1324
2016-07-11 22:21:49 -03:00
Bruno Oliveira 0dd1c8bf14 Add test to ensure capsys and capfd error out when using "getfixturevalue" inside a test 2016-07-11 20:48:38 -03:00
Bruno Oliveira 0ca06962e9 Improve docs 2016-07-11 20:33:16 -03:00
Bruno Oliveira fb4da00a32 Merge remote-tracking branch 'upstream/features' into invocation-scoped-fixtures 2016-07-11 20:09:13 -03:00
Bruno Oliveira 8ed055efd8 Add acceptance test for invocation-scoped fixtures 2016-07-09 22:52:07 -03:00
Ronny Pfannschmidt 8c49561470 split most fixture related code into own plugin 2016-07-09 20:36:00 +02: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
Javier Domingo Cansino 0171cfa30f Fixing link to issue and creating testcase that shows that it finds the line in the stderr lines 2016-07-05 10:39:12 +01:00
Steffen Allner b650c3c118 Implement --setup-show cli flag
to also be able to see fixture setup with normal test execution.
2016-07-03 22:30:51 +02:00
Ronny Pfannschmidt 1451a1ab00 remove unsupported python versions from code/source xfail 2016-06-30 10:03:40 +02:00
Bruno Oliveira ccd395ffe0 Merge pull request #1659 from RonnyPfannschmidt/failtest-586
xfailing test for #568
2016-06-27 07:38:14 -03:00
Ronny Pfannschmidt 76756c0c0b mark tests: use better name of the test for #568 2016-06-27 11:57:21 +02:00
Bruno Oliveira 5891061ac1 Merge pull request #1675 from kvas-it/issue-1562
Add warning for assertions on tuples #1562
2016-06-26 16:09:15 -03:00
RedBeardCode 0e2ebc96ff Remove deprecated cmd options
Fixes #1657
2016-06-26 19:26:04 +02:00
aostr 1ce4670062 * removed tailing whitespaces 2016-06-26 06:51:57 +02:00
Vasily Kuznetsov 6d4cee2159 Add a test for indirect use of tuple in the assert that should not cause a warning 2016-06-26 02:21:51 +02:00
Vasily Kuznetsov c17027e576 Warn about asserts on tuples (fixes #1562) 2016-06-25 19:21:48 +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
RedBeardCode e2f550156e Improve of the test output for logical expression with brackets.
Fixes #925
2016-06-25 18:10:36 +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