summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Edmund Crosley <timothy.crosley@gmail.com>2019-03-23 23:37:15 -0700
committerTimothy Crosley <timothy.crosley@gmail.com>2019-03-24 18:23:24 -0700
commit3dbbc6b01d6cfc9a133a95ad9438425cd635377e (patch)
tree98cc01882e85d79c01885ae8133bc03a19a2c5c5
parentfa84e03d03a1c11e538177d83c73a3fa589a5c36 (diff)
downloadisort-3dbbc6b01d6cfc9a133a95ad9438425cd635377e.tar.gz
Merge pull request #913 from timothycrosley/feature/fix-issue-902
Feature/fix issue 902
-rw-r--r--CHANGELOG.md1
-rw-r--r--isort/settings.py8
2 files changed, 5 insertions, 4 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 94f5ecfa..53d83b9d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -16,6 +16,7 @@ Planned:
### 4.3.16 - March 23, 2019 - hot fix release
- Fixed issue #909 - skip and skip-glob are not enforced when using settings-path.
- Fixed issue #907 - appdirs optional requirement does not correctly specify version
+- Fixed issue #902 - Too broad warning about missing toml package
- Fixed issue #778 - remove `user` from known standard library as it's no longer in any supported Python version.
### 4.3.15 - March 10, 2019 - hot fix release
diff --git a/isort/settings.py b/isort/settings.py
index 34f658a7..5a00fa16 100644
--- a/isort/settings.py
+++ b/isort/settings.py
@@ -348,10 +348,10 @@ def _get_config_data(file_path: str, sections: Iterable[str]) -> Dict[str, Any]:
config_section = config_section.get(key, {})
settings.update(config_section)
else:
- warnings.warn(
- "Found %s but toml package is not installed. To configure "
- "isort with %s, install with 'isort[pyproject]'." % (file_path, file_path)
- )
+ if '[tool.isort]' in config_file.read():
+ warnings.warn("Found {} with [tool.isort] section, but toml package is not installed. "
+ "To configure isort with {}, install with 'isort[pyproject]'.".format(file_path,
+ file_path))
else:
if file_path.endswith('.editorconfig'):
line = '\n'