1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-09-18 19:22:32 +01:00

Switch from pathlib to pathlib2

The pathlib backport module is no longer maintained. The development
has moved to the pathlib2 module instead.

Quoting from the pathlib's README:
"Attention: this backport module isn't maintained anymore. If you want
to report issues or contribute patches, please consider the pathlib2
project instead."
This commit is contained in:
Alessio Sergi
2016-05-12 17:17:17 +02:00
parent d2b0b6e8ec
commit ebf1ea88f5
7 changed files with 28 additions and 8 deletions

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})