audreyfeldroy / cookiecutter-pypackage

Cookiecutter template for a Python package.
BSD 3-Clause "New" or "Revised" License
4.26k stars 1.78k forks source link

Test fail when argument order are reversed in config #670

Open mazzma12 opened 2 years ago

mazzma12 commented 2 years ago

Description

I am trying to add new tests and I noticed that swapping the argument order in the init config will let the current test fail. Do you know why ? I don't understand since it does not look than anything is built based on argument order (to me)

What I Did

sed -i 's/"Click", "Argparse"/"Argparse", "Click"/g' ./cookiecutter.json

Then running the test produce 2 tests to fail:

self = <click.testing.CliRunner object at 0x7f77df476e90>, cli = <function main at 0x7f77df51ca60>

    def get_default_prog_name(self, cli: "BaseCommand") -> str:
        """Given a command object it will return the default program name
        for it.  The default is the `name` attribute or ``"root"`` if not
        set.
        """
>       return cli.name or "root"
E       AttributeError: 'function' object has no attribute 'name'

../../../.pyenv/versions/cs310/lib/python3.10/site-packages/click/testing.py:195: AttributeError
=============================================================== short test summary info ===============================================================
FAILED tests/test_bake_project.py::test_bake_with_console_script_cli - AttributeError: 'function' object has no attribute 'name'
FAILED tests/test_bake_project.py::test_bake_with_argparse_console_script_cli - AttributeError: 'function' object has no attribute 'name
audreyfeldroy commented 1 year ago

@mazzma12 thanks a ton for catching this, and for the detailed issue report and PR :pray:

audreyfeldroy commented 1 year ago

@CodiumAI-Agent /describe

audreyfeldroy commented 1 year ago

@CodiumAI-Agent /ask What do you mean by handle the case sensitivity issue within the code itself?

mazzma12 commented 1 year ago

@mazzma12 thanks a ton for catching this, and for the detailed issue report and PR 🙏

You welcome ! (Silently watching AI at work :smile: )

mazzma12 commented 1 year ago

@mazzma12 thanks a ton for catching this, and for the detailed issue report and PR 🙏

You welcome ! (Silently watching AI at work :smile: )