Skip to content

Commit

Permalink
Update code.
Browse files Browse the repository at this point in the history
  • Loading branch information
icemac committed Jan 15, 2025
1 parent a850b9c commit b74f71c
Show file tree
Hide file tree
Showing 22 changed files with 31 additions and 33 deletions.
5 changes: 2 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
name='zope.pytestlayer',
version='8.3.dev0',

python_requires='>=3.7',
python_requires='>=3.9',
install_requires=[
'pytest >= 6, < 8',
'setuptools',
Expand Down Expand Up @@ -49,12 +49,11 @@
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: Implementation",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
Expand Down
6 changes: 3 additions & 3 deletions src/zope/pytestlayer/fixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import zope.dottedname.resolve


class ZopeLayerState(object):
class ZopeLayerState:

def __init__(self):
self.current = set()
Expand Down Expand Up @@ -104,7 +104,7 @@ def get_layer_name(layer):
# As per zope.testrunner conventions, a layer is assumed to have a
# __name__ even if it's not a class.
name = layer.__name__
return '%s.%s' % (layer.__module__, name)
return f'{layer.__module__}.{name}'


def make_identifier(string):
Expand All @@ -115,7 +115,7 @@ def make_identifier(string):
def get_fixture_name(layer, scope):
name = make_identifier(get_layer_name(layer))
layerid = id(layer)
return 'zope_layer_{scope}_{name}_{layerid}'.format(**locals())
return f'zope_layer_{scope}_{name}_{layerid}'


LAYERS = {}
Expand Down
7 changes: 3 additions & 4 deletions src/zope/pytestlayer/layered.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class LayeredTestCaseFunction(_pytest.unittest.TestCaseFunction):
def from_parent(cls, parent, name, **kw):
description = get_description(parent)
keywords = get_keywords(description)
function = super(LayeredTestCaseFunction, cls).from_parent(
function = super().from_parent(
parent=parent,
name=name,
keywords=keywords,
Expand All @@ -66,7 +66,7 @@ def setup(self):

def teardown(self):
_testcase = self._testcase
super(LayeredTestCaseFunction, self).teardown()
super().teardown()
# Do not die with a meaningless error message when rerunning doctests:
self._testcase = _testcase

Expand Down Expand Up @@ -96,5 +96,4 @@ def walk_suite(suite):
fixture.raise_if_bad_layer(suite.layer)
yield item, suite.layer
else:
for result in walk_suite(item):
yield result
yield from walk_suite(item)
2 changes: 1 addition & 1 deletion src/zope/pytestlayer/tests/fixture/bad_layer/test_core.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import unittest


class FooLayer(object):
class FooLayer:
__name__ = 'FooLayer'


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from zope.pytestlayer.testing import log_to_terminal


class FooLayer(object):
class FooLayer:

@classmethod
def setUp(cls):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from zope.pytestlayer.testing import log_to_terminal


class FooLayer(object):
class FooLayer:

@classmethod
def setUp(cls):
Expand All @@ -24,7 +24,7 @@ def testTearDown(cls):
del cls.test_foo


class BarLayer(object):
class BarLayer:

@classmethod
def setUp(cls):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import unittest


class Layer(object):
class Layer:

def __init__(self, value, bases=()):
self.__name__ = 'TestLayer'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import unittest


class FooLayer(object):
class FooLayer:
pass


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from zope.pytestlayer.testing import log_to_terminal


class FooLayer(object):
class FooLayer:

@classmethod
def setUp(cls):
Expand All @@ -24,7 +24,7 @@ def testTearDown(cls):
del cls.test_foo


class BarLayer(object):
class BarLayer:

@classmethod
def setUp(cls):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from zope.pytestlayer.testing import log_to_terminal


class FooLayer(object):
class FooLayer:

@classmethod
def setUp(cls):
Expand All @@ -27,7 +27,7 @@ def testTearDown(cls):
del cls.test_foo


class BarLayer(object):
class BarLayer:

@classmethod
def setUp(cls):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from zope.pytestlayer.testing import log_to_terminal


class FooLayer(object):
class FooLayer:

@classmethod
def setUp(cls):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from zope.pytestlayer.testing import log_to_terminal


class FooLayer(object):
class FooLayer:

@classmethod
def setUp(cls):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from zope.pytestlayer.testing import log_to_terminal


class FooLayer(object):
class FooLayer:

@classmethod
def setUp(cls):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from zope.pytestlayer.testing import log_to_terminal


class FooLayer(object):
class FooLayer:

@classmethod
def setUp(cls):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from zope.pytestlayer.testing import log_to_terminal


class BarLayer(object):
class BarLayer:

@classmethod
def setUp(cls):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from zope.pytestlayer.testing import log_to_terminal


class FooLayer(object):
class FooLayer:

@classmethod
def setUp(cls):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from zope.pytestlayer.testing import log_to_terminal


class FooLayer(object):
class FooLayer:

@classmethod
def setUp(cls):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from zope.pytestlayer.testing import log_to_terminal


class FooLayer(object):
class FooLayer:

@classmethod
def setUp(cls):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from zope.pytestlayer.testing import log_to_terminal


class FooLayer(object):
class FooLayer:

@classmethod
def setUp(cls):
Expand All @@ -24,7 +24,7 @@ def testTearDown(cls):
del cls.test_foo


class BarLayer(object):
class BarLayer:

@classmethod
def setUp(cls):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from zope.pytestlayer.testing import log_to_terminal


class FooLayer(object):
class FooLayer:

@classmethod
def setUp(cls):
Expand Down
2 changes: 1 addition & 1 deletion src/zope/pytestlayer/tests/test_fixture.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from .. import fixture


class Layer(object):
class Layer:
pass


Expand Down
2 changes: 1 addition & 1 deletion src/zope/pytestlayer/tests/test_layer.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from zope.pytestlayer import fixture


class LayerClass(object):
class LayerClass:
pass


Expand Down

0 comments on commit b74f71c

Please sign in to comment.