1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-10-30 14:44:05 +00:00

Merge pull request #506 from asergi/pathlib2

Switch from pathlib to pathlib2
This commit is contained in:
Vladimir Iakovlev
2016-05-17 02:23:03 +03:00
7 changed files with 28 additions and 8 deletions

View File

@@ -1,4 +1,7 @@
from pathlib import Path
try:
from pathlib import Path
except ImportError:
from pathlib2 import Path
import pytest
from thefuck import shells
from thefuck import conf, const

View File

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

View File

@@ -3,7 +3,10 @@
import os
from subprocess import PIPE
from mock import Mock
from pathlib import Path
try:
from pathlib import Path
except ImportError:
from pathlib2 import Path
import pytest
from tests.utils import CorrectedCommand, Rule, Command
from thefuck import const