coverage report command does not need to specify ignoring 100% files: it's already specified in coverage conf file.

branch name checker tests ready at 100%
This commit is contained in:
Alvaro Andrés Rodríguez Scelza 2019-06-04 12:47:51 -03:00
parent 284c04df70
commit 3b8aa606c1
2 changed files with 38 additions and 1 deletions

View file

@ -3,7 +3,7 @@ ALL pre_commit_hooks tests, not only Loaderon's):
coverage erase
coverage run --source pre_commit_hooks -m pytest
coverage report --fail-under 100
coverage report
#######################################################################################################################

View file

@ -0,0 +1,37 @@
import subprocess
import sys
import uuid
import pytest
from pre_commit_hooks.loaderon_hooks.general_hooks.check_branch_name import main
@pytest.fixture(autouse=True)
def clean_sys_argv():
sys.argv = []
yield
def test_branch_name_ok():
new_branch_name = str(uuid.uuid4())
subprocess.check_output(['git', 'checkout', '-b', new_branch_name])
sys.argv.append('--regex')
sys.argv.append(r'\b(?!master)\b\S+')
result = main(sys.argv)
subprocess.check_output(['git', 'checkout', 'master'])
subprocess.check_output(['git', 'branch', '-d', new_branch_name])
assert result == 0
def test_branch_name_error():
subprocess.check_output(['git', 'checkout', 'master'])
sys.argv.append('--regex')
sys.argv.append(r'\b(?!master)\b\S+')
result = main(sys.argv)
assert result == 2