Skip to content

Commit

Permalink
Merge pull request #82 from testing-cabal/ruff
Browse files Browse the repository at this point in the history
Fix ruff issues and run ruff in CI
  • Loading branch information
jelmer authored Nov 24, 2023
2 parents bdc287c + a9dcdd8 commit 633efb5
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ jobs:
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: python -m pip install tox
run: python -m pip install tox ruff
- name: Run ruff
run: ruff check .
- name: Run unit tests (via tox)
# Run tox using the version of Python in `PATH`
run: tox -e py
Expand Down
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 633efb5

Please sign in to comment.