summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Crosley <timothy.crosley@gmail.com>2019-03-23 22:47:26 -0700
committerTimothy Crosley <timothy.crosley@gmail.com>2019-03-23 22:47:26 -0700
commit43f204e74775480667eeb504ef2be649c06791eb (patch)
treec0a0fec10152d71faf713d53b94588919011acd6
parent90984631b99e27095829a3abcceb279fb7b12032 (diff)
downloadisort-43f204e74775480667eeb504ef2be649c06791eb.tar.gz
Only warn if tool.isort section found
-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 3939c45a..91faeb47 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,7 @@ Changelog
### 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
### 4.3.15 - March 10, 2019 - hot fix release
- Fixed a regression with handling streaming input from pipes (Issue #895)
diff --git a/isort/settings.py b/isort/settings.py
index 336d0b1e..7324d5fd 100644
--- a/isort/settings.py
+++ b/isort/settings.py
@@ -289,10 +289,10 @@ def _get_config_data(file_path, sections):
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'