Skip to content

Commit

Permalink
Fix ruff issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jelmer committed Nov 24, 2023
1 parent bdc287c commit 7f5cdc3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
8 changes: 4 additions & 4 deletions fixtures/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@
]


from fixtures.fixture import (
from fixtures.fixture import ( # noqa: E402
CompoundFixture,
Fixture,
FunctionFixture,
MethodFixture,
MultipleExceptions,
SetupError,
)
from fixtures._fixtures import (
from fixtures._fixtures import ( # noqa: E402
ByteStream,
DetailStream,
EnvironmentVariable,
Expand All @@ -114,11 +114,11 @@
WarningsCapture,
WarningsFilter,
)
from fixtures.testcase import TestWithFixtures
from fixtures.testcase import TestWithFixtures # noqa: E402


def test_suite():
import fixtures.tests
import fixtures.tests # noqa: F401

return fixtures.tests.test_suite()

Expand Down
8 changes: 5 additions & 3 deletions fixtures/fixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def setUp(self):
self._clear_cleanups()
try:
self._setUp()
except:
except BaseException:
err = sys.exc_info()
details = {}
if gather_details is not None:
Expand Down Expand Up @@ -380,12 +380,14 @@ def setUp(self):
if setup is None:
setup = getattr(obj, 'setUp', None)
if setup is None:
setup = lambda: None
def setup():
return None
self._setup = setup
if cleanup is None:
cleanup = getattr(obj, 'tearDown', None)
if cleanup is None:
cleanup = lambda: None
def cleanup():
return None
self._cleanup = cleanup
if reset is None:
reset = getattr(obj, 'reset', None)
Expand Down
2 changes: 1 addition & 1 deletion fixtures/tests/_fixtures/test_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def test_logging_output_included_in_details(self):
self.assertEqual("some message\n", content.as_text())
except AssertionError:
raise
except:
except BaseException:
pass

def test_exceptionraised(self):
Expand Down
2 changes: 1 addition & 1 deletion fixtures/tests/_fixtures/test_monkeypatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def test_patch_missing_attribute(self):
self.assertFalse('new_attr' in globals())
fixture.setUp()
try:
self.assertEqual(True, new_attr)
self.assertEqual(True, new_attr) # noqa: F821
finally:
fixture.cleanUp()
self.assertFalse('new_attr' in globals())
Expand Down

0 comments on commit 7f5cdc3

Please sign in to comment.