Updated tests with the updated github stage names.

This commit is contained in:
Arnav Choudhury 2021-02-23 11:11:03 +05:30
parent a4f1acf17e
commit db636c8e36
2 changed files with 9 additions and 6 deletions

View File

@ -234,7 +234,7 @@ def test_gitlab_invokes_flake8_and_pytest(
("y", "docker-compose -f local.yml exec -T django pytest"), ("y", "docker-compose -f local.yml exec -T django pytest"),
], ],
) )
def test_github_invokes_flake8_and_pytest( def test_github_invokes_linter_and_pytest(
cookies, context, use_docker, expected_test_script cookies, context, use_docker, expected_test_script
): ):
context.update({"ci_tool": "Github", "use_docker": use_docker}) context.update({"ci_tool": "Github", "use_docker": use_docker})
@ -248,11 +248,11 @@ def test_github_invokes_flake8_and_pytest(
with open(f"{result.project}/.github/workflows/ci.yml", "r") as github_yml: with open(f"{result.project}/.github/workflows/ci.yml", "r") as github_yml:
try: try:
github_config = yaml.safe_load(github_yml) github_config = yaml.safe_load(github_yml)
flake8_present = False linter_present = False
for action_step in github_config["jobs"]["flake8"]["steps"]: for action_step in github_config["jobs"]["linter"]["steps"]:
if action_step.get("run") == "flake8": if action_step.get("run") == "linter":
flake8_present = True linter_present = True
assert flake8_present assert linter_present
expected_test_script_present = False expected_test_script_present = False
for action_step in github_config["jobs"]["pytest"]["steps"]: for action_step in github_config["jobs"]["pytest"]["steps"]:

View File

@ -33,6 +33,9 @@ jobs:
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install flake8 flake8-isort black pip install flake8 flake8-isort black
# Run all pre-commit hooks on all the files.
# Getting only staged files can be tricky in case a new PR is opened
# since the action is run on a branch in detached head state
- name: Install and Run Pre-commit - name: Install and Run Pre-commit
uses: pre-commit/action@v2.0.0 uses: pre-commit/action@v2.0.0