Skip to content

Commit

Permalink
Use base_path as a consistent test folder name.
Browse files Browse the repository at this point in the history
  • Loading branch information
freakboy3742 committed Feb 27, 2023
1 parent afd278b commit d3ce455
Show file tree
Hide file tree
Showing 21 changed files with 203 additions and 161 deletions.
2 changes: 1 addition & 1 deletion tests/commands/base/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def binary_path(self, app):

@pytest.fixture
def base_command(tmp_path):
command = DummyCommand(base_path=tmp_path / "project")
command = DummyCommand(base_path=tmp_path / "base_path")
command.parse_options(["-r", "default"])
return command

Expand Down
12 changes: 6 additions & 6 deletions tests/commands/base/test_parse_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def test_incomplete_global_config(base_command):
"""If the global configuration is missing a required argument, an error is
raised."""
# Provide a configuration that is missing `bundle`, a required attribute
filename = base_command.base_path / "project" / "pyproject.toml"
filename = base_command.base_path / "pyproject.toml"
create_file(
filename,
"""
Expand All @@ -38,7 +38,7 @@ def test_incomplete_global_config(base_command):
def test_incomplete_config(base_command):
"""If the configuration is missing a required argument, an error is raised."""
# Provide a configuration that is missing `bundle`, a required attribute
filename = base_command.base_path / "project" / "pyproject.toml"
filename = base_command.base_path / "pyproject.toml"
create_file(
filename,
"""
Expand All @@ -61,7 +61,7 @@ def test_incomplete_config(base_command):

def test_parse_config(base_command):
"""A well-formed configuration file can be augmented by the command line."""
filename = base_command.base_path / "project" / "pyproject.toml"
filename = base_command.base_path / "pyproject.toml"
create_file(
filename,
"""
Expand Down Expand Up @@ -117,7 +117,7 @@ def test_parse_config(base_command):

def test_parse_config_custom_config_classes_missing_global_arg(other_command):
"""A command that defines custom config classes can enforce global arguments."""
filename = other_command.base_path / "project" / "pyproject.toml"
filename = other_command.base_path / "base_path" / "pyproject.toml"
create_file(
filename,
"""
Expand Down Expand Up @@ -145,7 +145,7 @@ def test_parse_config_custom_config_classes_missing_global_arg(other_command):

def test_parse_config_custom_config_classes_missing_app_arg(other_command):
"""A command that defines custom config classes can enforce app arguments."""
filename = other_command.base_path / "project" / "pyproject.toml"
filename = other_command.base_path / "base_path" / "pyproject.toml"
create_file(
filename,
"""
Expand All @@ -169,7 +169,7 @@ def test_parse_config_custom_config_classes_missing_app_arg(other_command):

def test_parse_config_custom_config_classes(other_command):
"""A well-formed configuration file can be augmented by the command line."""
filename = other_command.base_path / "project" / "pyproject.toml"
filename = other_command.base_path / "base_path" / "pyproject.toml"
create_file(
filename,
"""
Expand Down
2 changes: 1 addition & 1 deletion tests/commands/base/test_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def test_bundle_path(base_command, my_app, tmp_path):

assert (
bundle_path
== tmp_path / "project" / "build" / "my-app_1.2.3" / "tester" / "dumdum"
== tmp_path / "base_path" / "build" / "my-app_1.2.3" / "tester" / "dumdum"
)


Expand Down
6 changes: 3 additions & 3 deletions tests/commands/build/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def update_command(self, app, **kwargs):

@pytest.fixture
def build_command(tmp_path):
return DummyBuildCommand(base_path=tmp_path / "project")
return DummyBuildCommand(base_path=tmp_path / "base_path")


@pytest.fixture
Expand All @@ -90,7 +90,7 @@ def second_app(second_app_config, tmp_path):
# but ensures that the binary for the app exists
create_file(
tmp_path
/ "project"
/ "base_path"
/ "build"
/ "second_0.0.2"
/ "tester"
Expand All @@ -100,7 +100,7 @@ def second_app(second_app_config, tmp_path):
)
create_file(
tmp_path
/ "project"
/ "base_path"
/ "build"
/ "second_0.0.2"
/ "tester"
Expand Down
6 changes: 3 additions & 3 deletions tests/commands/create/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def cleanup_app_content(self, app):
@pytest.fixture
def create_command(tmp_path, mock_git):
return DummyCreateCommand(
base_path=tmp_path / "project",
base_path=tmp_path / "base_path",
data_path=tmp_path / "data",
git=mock_git,
home_path=tmp_path / "home",
Expand All @@ -143,7 +143,7 @@ def create_command(tmp_path, mock_git):
def tracking_create_command(tmp_path, mock_git):
return TrackingCreateCommand(
git=mock_git,
base_path=tmp_path / "project",
base_path=tmp_path / "base_path",
apps={
"first": AppConfig(
app_name="first",
Expand Down Expand Up @@ -185,7 +185,7 @@ def bundle_path(myapp, tmp_path):
# exist, and the briefcase index file has been created.
bundle_path = (
tmp_path
/ "project"
/ "base_path"
/ "build"
/ f"{myapp.app_name}_{myapp.version}"
/ "tester"
Expand Down
8 changes: 4 additions & 4 deletions tests/commands/create/test_call.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ def test_create(tracking_create_command, tmp_path):

# New app content has been created
assert (
tmp_path / "project" / "build" / "first_0.0.1" / "tester" / "dummy" / "new"
tmp_path / "base_path" / "build" / "first_0.0.1" / "tester" / "dummy" / "new"
).exists()
assert (
tmp_path / "project" / "build" / "second_0.0.2" / "tester" / "dummy" / "new"
tmp_path / "base_path" / "build" / "second_0.0.2" / "tester" / "dummy" / "new"
).exists()


Expand All @@ -79,8 +79,8 @@ def test_create_single(tracking_create_command, tmp_path):

# New app content has been created
assert (
tmp_path / "project" / "build" / "first_0.0.1" / "tester" / "dummy" / "new"
tmp_path / "base_path" / "build" / "first_0.0.1" / "tester" / "dummy" / "new"
).exists()
assert not (
tmp_path / "project" / "build" / "second_0.0.2" / "tester" / "dummy" / "new"
tmp_path / "base_path" / "build" / "second_0.0.2" / "tester" / "dummy" / "new"
).exists()
10 changes: 5 additions & 5 deletions tests/commands/create/test_create_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def test_create_app(tracking_create_command, tmp_path):

# New app content has been created
assert (
tmp_path / "project" / "build" / "first_0.0.1" / "tester" / "dummy" / "new"
tmp_path / "base_path" / "build" / "first_0.0.1" / "tester" / "dummy" / "new"
).exists()


Expand All @@ -34,7 +34,7 @@ def test_create_existing_app_overwrite(tracking_create_command, tmp_path):
tracking_create_command.input.values = ["y"]

# Generate an app in the location.
bundle_path = tmp_path / "project" / "build" / "first_0.0.1" / "tester" / "dummy"
bundle_path = tmp_path / "base_path" / "build" / "first_0.0.1" / "tester" / "dummy"
bundle_path.mkdir(parents=True)
with (bundle_path / "original").open("w") as f:
f.write("original template!")
Expand Down Expand Up @@ -69,7 +69,7 @@ def test_create_existing_app_no_overwrite(tracking_create_command, tmp_path):
# Answer no when asked
tracking_create_command.input.values = ["n"]

bundle_path = tmp_path / "project" / "build" / "first_0.0.1" / "tester" / "dummy"
bundle_path = tmp_path / "base_path" / "build" / "first_0.0.1" / "tester" / "dummy"
bundle_path.mkdir(parents=True)
with (bundle_path / "original").open("w") as f:
f.write("original template!")
Expand All @@ -95,7 +95,7 @@ def test_create_existing_app_no_overwrite_default(tracking_create_command, tmp_p
# Answer '' (i.e., just press return) when asked
tracking_create_command.input.values = [""]

bundle_path = tmp_path / "project" / "build" / "first_0.0.1" / "tester" / "dummy"
bundle_path = tmp_path / "base_path" / "build" / "first_0.0.1" / "tester" / "dummy"
bundle_path.mkdir(parents=True)
with (bundle_path / "original").open("w") as f:
f.write("original template!")
Expand All @@ -122,7 +122,7 @@ def test_create_existing_app_input_disabled(tracking_create_command, tmp_path):
# Answer '' (i.e., just press return) when asked
tracking_create_command.input.enabled = False

bundle_path = tmp_path / "project" / "build" / "first_0.0.1" / "tester" / "dummy"
bundle_path = tmp_path / "base_path" / "build" / "first_0.0.1" / "tester" / "dummy"
bundle_path.mkdir(parents=True)
with (bundle_path / "original").open("w") as f:
f.write("original template!")
Expand Down
32 changes: 16 additions & 16 deletions tests/commands/create/test_generate_app_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def test_default_template(
no_input=True,
checkout=expected_branch,
output_dir=os.fsdecode(
tmp_path / "project" / "build" / "my-app_1.2.3" / "tester"
tmp_path / "base_path" / "build" / "my-app_1.2.3" / "tester"
),
extra_context=full_context,
)
Expand Down Expand Up @@ -134,7 +134,7 @@ def test_default_template_dev(
no_input=True,
checkout="v37.42.7",
output_dir=os.fsdecode(
tmp_path / "project" / "build" / "my-app_1.2.3" / "tester"
tmp_path / "base_path" / "build" / "my-app_1.2.3" / "tester"
),
extra_context=full_context,
),
Expand All @@ -143,7 +143,7 @@ def test_default_template_dev(
no_input=True,
checkout="main",
output_dir=os.fsdecode(
tmp_path / "project" / "build" / "my-app_1.2.3" / "tester"
tmp_path / "base_path" / "build" / "my-app_1.2.3" / "tester"
),
extra_context=full_context,
),
Expand Down Expand Up @@ -184,7 +184,7 @@ def test_default_template_dev_explicit_branch(
no_input=True,
checkout=branch,
output_dir=os.fsdecode(
tmp_path / "project" / "build" / "my-app_1.2.3" / "tester"
tmp_path / "base_path" / "build" / "my-app_1.2.3" / "tester"
),
extra_context=full_context,
),
Expand Down Expand Up @@ -232,7 +232,7 @@ def test_default_template_dev_explicit_invalid_branch(
no_input=True,
checkout=branch,
output_dir=os.fsdecode(
tmp_path / "project" / "build" / "my-app_1.2.3" / "tester"
tmp_path / "base_path" / "build" / "my-app_1.2.3" / "tester"
),
extra_context=full_context,
),
Expand Down Expand Up @@ -261,7 +261,7 @@ def test_explicit_branch(monkeypatch, create_command, myapp, full_context, tmp_p
no_input=True,
checkout=branch,
output_dir=os.fsdecode(
tmp_path / "project" / "build" / "my-app_1.2.3" / "tester"
tmp_path / "base_path" / "build" / "my-app_1.2.3" / "tester"
),
extra_context=full_context,
)
Expand All @@ -288,7 +288,7 @@ def test_platform_exists(monkeypatch, create_command, myapp, full_context, tmp_p
no_input=True,
checkout="v37.42.7",
output_dir=os.fsdecode(
tmp_path / "project" / "build" / "my-app_1.2.3" / "tester"
tmp_path / "base_path" / "build" / "my-app_1.2.3" / "tester"
),
extra_context=full_context,
)
Expand Down Expand Up @@ -316,7 +316,7 @@ def test_explicit_repo_template(
no_input=True,
checkout="v37.42.7",
output_dir=os.fsdecode(
tmp_path / "project" / "build" / "my-app_1.2.3" / "tester"
tmp_path / "base_path" / "build" / "my-app_1.2.3" / "tester"
),
extra_context=full_context,
)
Expand Down Expand Up @@ -351,7 +351,7 @@ def test_explicit_repo_template_and_branch(
no_input=True,
checkout=branch,
output_dir=os.fsdecode(
tmp_path / "project" / "build" / "my-app_1.2.3" / "tester"
tmp_path / "base_path" / "build" / "my-app_1.2.3" / "tester"
),
extra_context=full_context,
)
Expand All @@ -375,7 +375,7 @@ def test_explicit_local_template(
no_input=True,
checkout="v37.42.7",
output_dir=os.fsdecode(
tmp_path / "project" / "build" / "my-app_1.2.3" / "tester"
tmp_path / "base_path" / "build" / "my-app_1.2.3" / "tester"
),
extra_context=full_context,
)
Expand Down Expand Up @@ -409,7 +409,7 @@ def test_explicit_local_template_and_branch(
no_input=True,
checkout=branch,
output_dir=os.fsdecode(
tmp_path / "project" / "build" / "my-app_1.2.3" / "tester"
tmp_path / "base_path" / "build" / "my-app_1.2.3" / "tester"
),
extra_context=full_context,
)
Expand Down Expand Up @@ -450,7 +450,7 @@ def test_offline_repo_template(
no_input=True,
checkout="v37.42.7",
output_dir=os.fsdecode(
tmp_path / "project" / "build" / "my-app_1.2.3" / "tester"
tmp_path / "base_path" / "build" / "my-app_1.2.3" / "tester"
),
extra_context=full_context,
)
Expand Down Expand Up @@ -484,7 +484,7 @@ def test_invalid_repo_template(
no_input=True,
checkout="v37.42.7",
output_dir=os.fsdecode(
tmp_path / "project" / "build" / "my-app_1.2.3" / "tester"
tmp_path / "base_path" / "build" / "my-app_1.2.3" / "tester"
),
extra_context=full_context,
)
Expand Down Expand Up @@ -520,7 +520,7 @@ def test_missing_branch_template(
no_input=True,
checkout="v37.42.7",
output_dir=os.fsdecode(
tmp_path / "project" / "build" / "my-app_1.2.3" / "tester"
tmp_path / "base_path" / "build" / "my-app_1.2.3" / "tester"
),
extra_context=full_context,
)
Expand Down Expand Up @@ -557,7 +557,7 @@ def test_cached_template(monkeypatch, create_command, myapp, full_context, tmp_p
no_input=True,
checkout="v37.42.7",
output_dir=os.fsdecode(
tmp_path / "project" / "build" / "my-app_1.2.3" / "tester"
tmp_path / "base_path" / "build" / "my-app_1.2.3" / "tester"
),
extra_context=full_context,
)
Expand Down Expand Up @@ -608,7 +608,7 @@ def test_cached_template_offline(
no_input=True,
checkout="v37.42.7",
output_dir=os.fsdecode(
tmp_path / "project" / "build" / "my-app_1.2.3" / "tester"
tmp_path / "base_path" / "build" / "my-app_1.2.3" / "tester"
),
extra_context=full_context,
)
Expand Down
Loading

0 comments on commit d3ce455

Please sign in to comment.