Skip to content

Commit

Permalink
Merge pull request #113 from akx/no-testfixtures
Browse files Browse the repository at this point in the history
Drop testfixtures dependency
  • Loading branch information
gforcada committed Apr 27, 2022
2 parents c8072e0 + f06b8ad commit 5a42f5c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 16 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/tests.yml
Expand Up @@ -30,6 +30,10 @@ jobs:
architecture: x64
- name: Install matrix dependencies
run: pip install 'isort==${{ matrix.isort }}' 'flake8==${{ matrix.flake8 }}'
# isort 4.x requires `toml` to be able to read pyproject.toml, so install it...
- name: Install toml if required
run: pip install toml
if: matrix.isort == '4.3.21'
- name: Install dependencies
run: pip install .[test]
- name: flake8
Expand Down
2 changes: 1 addition & 1 deletion CHANGES.rst
Expand Up @@ -6,7 +6,7 @@ Changelog
4.1.2 (unreleased)
------------------

- Nothing changed yet.
- The package no longer depends on ``testfixtures``.


4.1.1 (2021-10-14)
Expand Down
24 changes: 10 additions & 14 deletions flake8_isort.py
@@ -1,18 +1,14 @@
# -*- coding: utf-8 -*-

import isort

from contextlib import redirect_stdout
from difflib import Differ
from difflib import unified_diff
from io import StringIO
from pathlib import Path

if hasattr(isort, 'api'): # isort 5
from contextlib import redirect_stdout
from difflib import unified_diff
from io import StringIO
from pathlib import Path
import isort
import warnings

import warnings
else:
from difflib import Differ
from testfixtures import OutputCapture

__version__ = '4.1.2.dev0'

Expand Down Expand Up @@ -46,7 +42,6 @@ def __init__(self, tree, filename, lines):

@classmethod
def add_options(cls, parser):

parser.add_option(
'--isort-show-traceback',
action='store_true',
Expand All @@ -68,7 +63,8 @@ def run(self):
file_path = self.filename
else:
file_path = None
with OutputCapture() as buffer:
buffer = StringIO()
with redirect_stdout(buffer):
sort_result = isort.SortImports(
file_path=file_path,
file_contents=''.join(self.lines),
Expand Down Expand Up @@ -129,7 +125,7 @@ def _format_isort_output(self, isort_buffer):
valid_lines = ['']
valid_lines += [
line
for line in isort_buffer.output.getvalue().splitlines()
for line in isort_buffer.getvalue().splitlines()
if line.strip().split(' ', 1)[0] not in filtering_out
]

Expand Down
1 change: 0 additions & 1 deletion setup.py
Expand Up @@ -57,7 +57,6 @@ def get_version(file="flake8_isort.py"):
install_requires=[
'flake8 >= 3.2.1, <5',
'isort >= 4.3.5, <6',
'testfixtures >= 6.8.0, <7',
],
extras_require={
'test': ['pytest-cov'],
Expand Down

0 comments on commit 5a42f5c

Please sign in to comment.