Skip to content

run mypy on tests directory#2059

Merged
jensens merged 6 commits intocookiecutter:mainfrom
danieleades:mypy-tests
Apr 18, 2024
Merged

run mypy on tests directory#2059
jensens merged 6 commits intocookiecutter:mainfrom
danieleades:mypy-tests

Conversation

@danieleades
Copy link
Copy Markdown
Contributor

No description provided.

@danieleades danieleades marked this pull request as draft April 6, 2024 08:52
@danieleades danieleades force-pushed the mypy-tests branch 3 times, most recently from 9fb47a0 to 1d33e55 Compare April 7, 2024 10:32
@danieleades
Copy link
Copy Markdown
Contributor Author

remaining errors are due to this monstrosity:

def run_pre_prompt_hook(repo_dir: Path | str) -> Path | str:
    """Run pre_prompt hook from repo directory.

    :param repo_dir: Project template input directory.
    """
    # Check if we have a valid pre_prompt script
    with work_in(repo_dir):
        scripts = find_hook('pre_prompt')
        if not scripts:
            return repo_dir

    # Create a temporary directory
    repo_dir = create_tmp_repo_dir(repo_dir)
    with work_in(repo_dir):
        scripts = find_hook('pre_prompt') or []
        for script in scripts:
            try:
                run_script(script, str(repo_dir))
            except FailedHookException as e:  # noqa: PERF203
                raise FailedHookException('Pre-Prompt Hook script failed') from e
    return repo_dir

which sometimes returns a str and sometimes a Path.

there are places in the codebase where it fails if it doesn't return a str, and other places where it fails if it doesn't return a Path, so it's not just a matter of refactoring it to return only one or the other.

@danieleades danieleades marked this pull request as ready for review April 7, 2024 10:58
@danieleades danieleades requested a review from jensens April 9, 2024 07:09
@jensens
Copy link
Copy Markdown
Contributor

jensens commented Apr 17, 2024

@danieleades well, somethings wrong after rebase/conflict solving? Any idea?

@danieleades
Copy link
Copy Markdown
Contributor Author

@danieleades well, somethings wrong after rebase/conflict solving? Any idea?

I'll take a look this evening!

@danieleades
Copy link
Copy Markdown
Contributor Author

@jensens should be good now

@jensens jensens merged commit 464c6b5 into cookiecutter:main Apr 18, 2024
@jensens jensens added the skip-changelog Can be missed from the changelog. label Apr 18, 2024
@danieleades danieleades deleted the mypy-tests branch April 19, 2024 07:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-changelog Can be missed from the changelog.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants