Skip to content

Commit

Permalink
Version 0.1.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
sobolevn committed Dec 18, 2018
1 parent 1b15fdc commit ff4323c
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dotenv_linter/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# https://click.palletsprojects.com/en/7.x/arguments/

import sys
from typing import NoReturn, Tuple
from typing import Tuple

import click
from click_default_group import DefaultGroup
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ addopts =
--cov=dotenv_linter
--cov-report=term:skip-covered
--cov-report=html
--cov-fail-under=96
--cov-fail-under=98


[isort]
Expand Down
3 changes: 3 additions & 0 deletions tests/fixtures/.env.parsing
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)
63 changes: 63 additions & 0 deletions tests/test_cli/test_bad_arguments.py
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

0 comments on commit ff4323c

Please sign in to comment.