-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Smoke tests for assorted plugins #7721
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
a6b5de7
New tox environment to test integration with some third part plugins
ssbarnea 0a27f69
Fix early_config.known_args_namespace not containing third-party options
nicoddemus d39b45c
Force color in one run for pytest sugar to kick in CI
nicoddemus 83c648f
Add pytest-mock integration testing
nicoddemus 59ee460
Add a README to testing/plugins_integration
nicoddemus be7c509
Add pytest-asyncio integration testing
nicoddemus 5ce8c92
Add pytest-trio integration testing
nicoddemus 0568fc7
Change python_files to only collect *.py in testing/python
nicoddemus 222a120
Force sugar output properly now on CI
nicoddemus b2795f8
Sort and match plugin deps and commands
nicoddemus 80a3345
add anyio smoke tests, and plugin recommendation
graingert f0eeb2c
Add pytest-qt and pytest-flakes
nicoddemus 6be9f7c
Add pytest-bdd
nicoddemus 780752b
Remove pytest-qt due to the dependency to a X server
nicoddemus 5e322d6
Add pip_pre
nicoddemus 08de6dd
Add pytest-twisted smoke test
altendky d75da3d
Remove obsolete pytest_qt_integration.py
nicoddemus ba61962
Fix linting and cleanup pytest_twisted_integration a bit
nicoddemus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.html | ||
assets/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
This folder contains tests and support files for smoke testing popular plugins against the current pytest version. | ||
|
||
The objective is to gauge if any intentional or unintentional changes in pytest break plugins. | ||
|
||
As a rule of thumb, we should add plugins here: | ||
|
||
1. That are used at large. This might be subjective in some cases, but if answer is yes to | ||
the question: *if a new release of pytest causes pytest-X to break, will this break a ton of test suites out there?*. | ||
2. That don't have large external dependencies: such as external services. | ||
|
||
Besides adding the plugin as dependency, we should also add a quick test which uses some | ||
minimal part of the plugin, a smoke test. Also consider reusing one of the existing tests if that's | ||
possible. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Feature: Buy things with apple | ||
|
||
Scenario: Buy fruits | ||
Given A wallet with 50 | ||
|
||
When I buy some apples for 1 | ||
And I buy some bananas for 2 | ||
|
||
Then I have 47 left |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
from pytest_bdd import given | ||
from pytest_bdd import scenario | ||
from pytest_bdd import then | ||
from pytest_bdd import when | ||
|
||
import pytest | ||
|
||
|
||
@scenario("bdd_wallet.feature", "Buy fruits") | ||
def test_publish(): | ||
pass | ||
|
||
|
||
@pytest.fixture | ||
def wallet(): | ||
class Wallet: | ||
amount = 0 | ||
|
||
return Wallet() | ||
|
||
|
||
@given("A wallet with 50") | ||
def fill_wallet(wallet): | ||
wallet.amount = 50 | ||
|
||
|
||
@when("I buy some apples for 1") | ||
def buy_apples(wallet): | ||
wallet.amount -= 1 | ||
|
||
|
||
@when("I buy some bananas for 2") | ||
def buy_bananas(wallet): | ||
wallet.amount -= 2 | ||
|
||
|
||
@then("I have 47 left") | ||
def check(wallet): | ||
assert wallet.amount == 47 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
SECRET_KEY = "mysecret" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[pytest] | ||
addopts = --strict-markers | ||
filterwarnings = | ||
error::pytest.PytestWarning |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import anyio | ||
|
||
import pytest | ||
|
||
|
||
@pytest.mark.anyio | ||
async def test_sleep(): | ||
await anyio.sleep(0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import asyncio | ||
|
||
import pytest | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_sleep(): | ||
await asyncio.sleep(0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
def test_mocker(mocker): | ||
mocker.MagicMock() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import trio | ||
|
||
import pytest | ||
|
||
|
||
@pytest.mark.trio | ||
async def test_sleep(): | ||
await trio.sleep(0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import pytest_twisted | ||
from twisted.internet.task import deferLater | ||
|
||
|
||
def sleep(): | ||
import twisted.internet.reactor | ||
|
||
return deferLater(clock=twisted.internet.reactor, delay=0) | ||
|
||
|
||
@pytest_twisted.inlineCallbacks | ||
def test_inlineCallbacks(): | ||
yield sleep() | ||
|
||
|
||
@pytest_twisted.ensureDeferred | ||
async def test_inlineCallbacks_async(): | ||
await sleep() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import pytest | ||
|
||
|
||
def test_foo(): | ||
assert True | ||
|
||
|
||
@pytest.mark.parametrize("i", range(3)) | ||
def test_bar(i): | ||
assert True |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.