-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
68 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# This is python! | ||
for var in [1, 2, 3]: | ||
print(var) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
import subprocess | ||
|
||
|
||
def test_empty_arguments(): | ||
"""Checks that `lint` command does not work without arguments.""" | ||
process = subprocess.Popen( | ||
['dotenv-linter'], | ||
stdout=subprocess.PIPE, | ||
stderr=subprocess.PIPE, | ||
universal_newlines=True, | ||
encoding='utf8', | ||
) | ||
_, stderr = process.communicate() | ||
|
||
assert process.returncode == 2 | ||
assert stderr != '' | ||
|
||
|
||
def test_lint_empty_arguments(): | ||
"""Checks that `lint` command does not work without arguments.""" | ||
process = subprocess.Popen( | ||
['dotenv-linter', 'lint'], | ||
stdout=subprocess.PIPE, | ||
stderr=subprocess.PIPE, | ||
universal_newlines=True, | ||
encoding='utf8', | ||
) | ||
_, stderr = process.communicate() | ||
|
||
assert process.returncode == 2 | ||
assert stderr != '' | ||
|
||
|
||
def test_lint_missing_files(): | ||
"""Checks that `lint` command does not work with non-existing file.""" | ||
process = subprocess.Popen( | ||
['dotenv-linter', 'lint', 'sd'], | ||
stdout=subprocess.PIPE, | ||
stderr=subprocess.PIPE, | ||
universal_newlines=True, | ||
encoding='utf8', | ||
) | ||
_, stderr = process.communicate() | ||
|
||
assert process.returncode == 2 | ||
assert stderr != '' | ||
|
||
|
||
def test_lint_parsing_violation(fixture_path): | ||
"""Checks that `lint` command does not work with parsing errors.""" | ||
process = subprocess.Popen( | ||
['dotenv-linter', 'lint', fixture_path('.env.parsing')], | ||
stdout=subprocess.PIPE, | ||
stderr=subprocess.PIPE, | ||
universal_newlines=True, | ||
encoding='utf8', | ||
) | ||
_, stderr = process.communicate() | ||
|
||
assert process.returncode == 1 | ||
assert '001' in stderr |