Skip to content

Commit

Permalink
Fix: Fix isort skipping
Browse files Browse the repository at this point in the history
* fix: fix isort skipping

* chore: update code style of imports

* chore: fix import style in test folder

* fix: add exclude to pre commit for example test

* fix: fix import order to match isort

* fix: exclude run_pipeline from initial pre-commits
  • Loading branch information
joshlynchONS committed Mar 30, 2023
1 parent 41f6d05 commit 1b0652b
Show file tree
Hide file tree
Showing 14 changed files with 34 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ repos:
hooks:
- id: isort
name: isort - Sort Python imports (auto-fixes)
types: [ cython, pyi, python ]
args: [ "--profile", "black", "--filter-files" ]
exclude: test_example_module.py|run_pipeline.py
- repo: https://github.com/psf/black
rev: 22.8.0 # Replace by any tag/version: https://github.com/psf/black/tags
hooks:
Expand Down
1 change: 1 addition & 0 deletions tests/test_documentation_build.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from pathlib import Path

from sphinx.cmd.build import main


Expand Down
3 changes: 2 additions & 1 deletion tests/test_env.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from dotenv import dotenv_values
from pathlib import Path
from typing import Dict, List

from dotenv import dotenv_values

# Define a path to the `govcookiecutter` template directory, and its `.env` file
DIR_TEMPLATE = Path("{{ cookiecutter.repo_name }}")
PATH_TEMPLATE_ENV = DIR_TEMPLATE.joinpath(".env")
Expand Down
5 changes: 3 additions & 2 deletions tests/test_govcookiecutter_creation.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from sphinx.cmd.build import main
import re
from typing import Dict

import pytest
import re
from sphinx.cmd.build import main


@pytest.mark.parametrize("test_input_repository_hosting_platform", ["GitHub", "GitLab"])
Expand Down
2 changes: 1 addition & 1 deletion tests/test_govcookiecutter_injected_variables.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from collections import Counter
from pathlib import Path
from typing import Dict, List, Union
import pytest

import pytest

# Define the expected counts for each cookiecutter variable - any counts that deviate
# because of other variables are listed at the end of each dictionary
Expand Down
1 change: 1 addition & 0 deletions tests/test_post_gen_project/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from pathlib import Path
from typing import List

import pytest


Expand Down
4 changes: 3 additions & 1 deletion tests/test_post_gen_project/test_delete_files_and_folders.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
from hooks.post_gen_project import delete_files_and_folders
from pathlib import Path
from typing import List
from unittest.mock import MagicMock, call

import pytest

from hooks.post_gen_project import delete_files_and_folders


@pytest.fixture
def patch_rmtree(mocker) -> MagicMock:
Expand Down
6 changes: 4 additions & 2 deletions tests/test_post_gen_project/test_parse_features_json.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import json
from collections import Counter
from hooks.post_gen_project import parse_features_json
from pathlib import Path
from typing import Dict, List
import json

import pytest

from hooks.post_gen_project import parse_features_json

# Keys for the JSON file
JSON_BASE_KEYS = ["name", "remove", "resources"]

Expand Down
4 changes: 3 additions & 1 deletion tests/test_post_gen_project/test_set_aqa_framework.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from hooks.post_gen_project import delete_files_and_folders, set_aqa_framework
from pathlib import Path
from unittest.mock import MagicMock

import pytest

from hooks.post_gen_project import delete_files_and_folders, set_aqa_framework


@pytest.fixture
def patch_delete_files_and_folders(mocker) -> MagicMock:
Expand Down
3 changes: 2 additions & 1 deletion tests/test_post_gen_project/test_set_request_template.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from hooks.post_gen_project import set_request_template
from pathlib import Path

import pytest

from hooks.post_gen_project import set_request_template

# Define test cases for the `TestSetRequestTemplate` test class
args_test_set_request_template_valueerror_for_bad_repository_hosting_platform = [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from hooks.pre_gen_project import check_valid_email_address_format
import pytest

from hooks.pre_gen_project import check_valid_email_address_format

# Define test cases for the `TestCheckValidEmailAddressFormat` test class
args_invalid_email_addresses = ["hello.world", "foo_bar"]
args_valid_email_addresses = ["hello@world.com", "foo@bar"]
Expand Down
11 changes: 9 additions & 2 deletions {{ cookiecutter.repo_name }}/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,15 @@ repos:
rev: 5.12.0
hooks:
- id: isort
name: isort - Sort Python imports (auto-fixes)
types: [ cython, pyi, python ]
name: isort - Sort python imports (auto-fixes)
args: [ "--profile", "black", "--filter-files" ]
- id: isort
name: isort - Sort cython imports (auto-fixes)
types: [cython]
args: [ "--profile", "black", "--filter-files" ]
- id: isort
name: isort - Sort pyi imports (auto-fixes)
types: [pyi]
args: [ "--profile", "black", "--filter-files" ]
- repo: https://github.com/psf/black
rev: 22.8.0 # Replace by any tag/version: https://github.com/psf/black/tags
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

from {{ cookiecutter.repo_name.lower().replace(' ', '_').replace('-', '_') }}.example_modules.example_module import (
hello_world,
print_string,
print_favourite_number,
print_string,
)


Expand Down
2 changes: 1 addition & 1 deletion {{ cookiecutter.repo_name }}/tests/test_example_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

from {{ cookiecutter.repo_name.lower().replace(' ', '_').replace('-', '_') }}.example_modules.example_module import (
hello_world,
print_string,
print_favourite_number,
print_string,
)


Expand Down

0 comments on commit 1b0652b

Please sign in to comment.