Skip to content

Commit

Permalink
Merge pull request #621 from ZeitOnline/maint/mark
Browse files Browse the repository at this point in the history
FIX: Don't try to add pytest mark to doctest, it seems to apply to *all* doctests
  • Loading branch information
wosc committed Feb 15, 2024
2 parents 76787d3 + 134f15e commit 1d7bebf
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 23 deletions.
10 changes: 0 additions & 10 deletions core/src/zeit/connector/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from sqlalchemy.exc import OperationalError
import docker
import plone.testing
import pytest
import requests
import sqlalchemy
import transaction
Expand Down Expand Up @@ -320,7 +319,6 @@ def get_resource(self, name, body=b'', properties=None, contentType='text/plain'
)


@pytest.mark.slow()
class ConnectorTest(TestCase):
layer = REAL_CONNECTOR_LAYER
level = 2
Expand All @@ -343,14 +341,6 @@ def FunctionalDocFileSuite(*paths, **kw):
return zeit.cms.testing.FunctionalDocFileSuite(*paths, **kw)


def mark_doctest_suite(suite, mark):
# Imitate pytest magic, see _pytest.python.transfer_markers
for test in suite:
func = test.runTest.__func__
mark(func)
test.runTest = func.__get__(test)


def print_tree(connector, base):
"""Helper to print a tree."""
print('\n'.join(list_tree(connector, base)))
Expand Down
3 changes: 0 additions & 3 deletions core/src/zeit/connector/tests/test_doctest.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import unittest

import pytest

import zeit.cms.testing
import zeit.connector.connector
import zeit.connector.testing
Expand All @@ -23,7 +21,6 @@ def test_suite():
'invalidation-events.txt',
layer=zeit.connector.testing.ZOPE_CONNECTOR_LAYER,
)
zeit.connector.testing.mark_doctest_suite(functional, pytest.mark.slow)
suite.addTest(functional)

suite.addTest(zeit.cms.testing.DocFileSuite('search.txt', package='zeit.connector'))
Expand Down
6 changes: 1 addition & 5 deletions core/src/zeit/connector/tests/test_doctest2.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import pytest

import zeit.cms.testing
import zeit.connector.connector
import zeit.connector.testing
Expand All @@ -8,7 +6,7 @@
def test_suite():
# Need to put this into a separate file, otherwise gocept.pytestlayers
# does not tear down other layers before running this.
suite = zeit.connector.testing.FunctionalDocFileSuite(
return zeit.connector.testing.FunctionalDocFileSuite(
'locking.txt',
'resource.txt',
'search-ft.txt',
Expand All @@ -17,5 +15,3 @@ def test_suite():
# 'stressing.txt',
layer=zeit.connector.testing.REAL_CONNECTOR_LAYER,
)
zeit.connector.testing.mark_doctest_suite(suite, pytest.mark.slow)
return suite
5 changes: 0 additions & 5 deletions core/src/zeit/pytest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,4 @@ def pytest_configure(config):
config.addinivalue_line(
'markers', 'integration: Thirdparty integration tests are not run by default.'
)
config.addinivalue_line(
'markers',
'slow: This is a non-unit test and thus is not run by '
'default. Use ``-m slow`` to run these, or ``-m 1`` to run all tests.',
)
config.addinivalue_line('markers', 'selenium: Selenium tests are not run by default.')

0 comments on commit 1d7bebf

Please sign in to comment.