summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Edmund Crosley <timothy.crosley@gmail.com>2019-03-09 21:57:17 -0800
committerGitHub <noreply@github.com>2019-03-09 21:57:17 -0800
commit545dafeca4d0691900b24c98da32edc029edf6fd (patch)
tree6fbf539e211cd89d9f1be5f8d3972734e703264b
parent8b734147b289dfd1a281f3426a035760f6ab1f52 (diff)
parentc409e8d32bb66e0f1de11b19b0e4236022fa9b51 (diff)
downloadisort-545dafeca4d0691900b24c98da32edc029edf6fd.tar.gz
Merge pull request #894 from timothycrosley/feature/fix-skip-of-star-dir-glob
Feature/fix skip of star dir glob
-rw-r--r--isort/settings.py2
-rw-r--r--test_isort.py3
2 files changed, 3 insertions, 2 deletions
diff --git a/isort/settings.py b/isort/settings.py
index b1075148..336d0b1e 100644
--- a/isort/settings.py
+++ b/isort/settings.py
@@ -344,7 +344,7 @@ def should_skip(filename, config, path=''):
position = os.path.split(position[0])
for glob in config['skip_glob']:
- if fnmatch.fnmatch(filename, glob):
+ if fnmatch.fnmatch(filename, glob) or fnmatch.fnmatch('/' + filename, glob):
return True
if not (os.path.isfile(os_path) or os.path.isdir(os_path) or os.path.islink(os_path)):
diff --git a/test_isort.py b/test_isort.py
index 998f32c5..58d27d17 100644
--- a/test_isort.py
+++ b/test_isort.py
@@ -2782,7 +2782,8 @@ def test_safety_excludes(tmpdir, enabled):
assert file_names == {'verysafe.py'}
-@pytest.mark.parametrize('skip_glob_assert', (([], 0, {os.sep.join(('code', 'file.py'))}), (['**/*.py'], 1, {})))
+@pytest.mark.parametrize('skip_glob_assert', (([], 0, {os.sep.join(('code', 'file.py'))}), (['**/*.py'], 1, {}),
+ (['*/code/*.py'], 1, {})))
def test_skip_glob(tmpdir, skip_glob_assert):
skip_glob, skipped_count, file_names = skip_glob_assert
base_dir = tmpdir.mkdir('build')