Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop testfixtures dependency #113

Merged
merged 3 commits into from Apr 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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