1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-10-30 06:34:09 +00:00

#N/A: Move imports from pathlib/pathlib2 to utils

This commit is contained in:
Vladimir Iakovlev
2016-08-14 15:01:00 +03:00
parent 1f75fc1ea9
commit 176924c18d
7 changed files with 14 additions and 35 deletions

View File

@@ -1,10 +1,7 @@
try:
from pathlib import Path
except ImportError:
from pathlib2 import Path
import pytest
from thefuck import shells
from thefuck import conf, const
from thefuck.utils import Path
shells.shell = shells.Generic()

View File

@@ -1,13 +1,8 @@
# -*- coding: utf-8 -*-
import pytest
try:
from pathlib import Path
pathlib_name = 'pathlib'
except ImportError:
from pathlib2 import Path
pathlib_name = 'pathlib2'
from thefuck import corrector, const
from thefuck.utils import Path
from tests.utils import Rule, Command, CorrectedCommand
from thefuck.corrector import get_corrected_commands, organize_commands
@@ -16,7 +11,7 @@ class TestGetRules(object):
@pytest.fixture
def glob(self, mocker):
results = {}
mocker.patch(pathlib_name + '.Path.glob',
mocker.patch('thefuck.utils.Path.glob',
new_callable=lambda: lambda *_: results.pop('value', []))
return lambda value: results.update({'value': value})

View File

@@ -3,14 +3,11 @@
import os
from subprocess import PIPE
from mock import Mock
try:
from pathlib import Path
except ImportError:
from pathlib2 import Path
import pytest
from tests.utils import CorrectedCommand, Rule, Command
from thefuck import const
from thefuck.exceptions import EmptyCommand
from thefuck.utils import Path
class TestCorrectedCommand(object):