beeware / briefcase

Tools to support converting a Python project into a standalone native application.
https://briefcase.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
2.47k stars 350 forks source link

Add force parameter to create #1870

Open svdgoor opened 3 weeks ago

svdgoor commented 3 weeks ago

Adds a parameter to the briefcase create command to skip confirming overwriting existing scaffolds. This makes it easier to test this part of building, such as when debugging new changes to this system, or to investigate problems when people (like myself earlier today) have an issue in their scaffold.

The tests do not pass anymore. I looked at them, and I see why, but I would rather leave the decision about how to solve them to you. I hope CI will automatically apply to the PR, otherwise I will paste a log of vox here later.

mhsmith commented 3 weeks ago

The tests do not pass anymore. I looked at them, and I see why, but I would rather leave the decision about how to solve them to you. I hope CI will automatically apply to the PR, otherwise I will paste a log of vox here later.

CI isn't running the tests yet because there are failures in the pre-commit and towncrier checks. To find out how to fix these, follow the "Details" links below.

svdgoor commented 1 week ago

Apologies, my changes were not yet complete. I am still working on them.

svdgoor commented 1 week ago

perhaps, @freakboy3742, you could provide guidance on how to adapt the tests so that they still capture the way empty (parameter-less) commands have their help generated. Currently, the testing units is using the create method (which is empty before this change) as an empty command for its unit tests.

svdgoor commented 1 week ago

Update:

The tests still fail since the create command was used as placeholder.

This is something I believe should be addressed as follows:

  1. Create a placeholder command
  2. Make this command available only when running unit tests
  3. Run the unit tests against this command
freakboy3742 commented 1 week ago

Update:

  • Resolved failed test cases where it makes sense; in the tests specifically for the create command
  • Added TODOs for each of the test cases which failed on Windows, where create was merely used as a base command.

The tests still fail since the create command was used as placeholder.

This is something I believe should be addressed as follows:

  1. Create a placeholder command
  2. Make this command available only when running unit tests
  3. Run the unit tests against this command

There's another option: promote --force to a top level option. We already have --no-input; most commands don't accept input, so the option clearly isn't at the base level because it's "universal". --force is a sufficiently common "YOLO" option that I'd be comfortable adding it as a top-level option in BaseCommand so that any command could potentially honour (although, at present, it would only be used by create).

Unless I'm mistaken, this should simplify most of the test cases you've identified as a problem.