Skip to content

Commit

Permalink
build: remove defaults channel (#189)
Browse files Browse the repository at this point in the history
* build: change conda defaults channel to nodefaults

* fix: move test_install into separate test class
  • Loading branch information
sqr00t committed Apr 18, 2024
1 parent 9e829c4 commit 9c3f162
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
26 changes: 19 additions & 7 deletions tests/test_creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,14 @@ def test_conda(self):
# Add an extra conda dependency
check_output(["echo", " - tqdm", ">>", "environment.yaml"])
p = shell(["make", "conda-update"])

p = shell(["make", "conda-remove"])
except CalledProcessError:
log_path = Path(".cookiecutter/state/conda-create.log")
if log_path.exists():
with log_path.open() as f:
print("conda-create.log:\n", f.read())
raise
finally:
p = shell(["make", "conda-remove"])

def test_git(self):
"""Test expected git branches exist."""
Expand All @@ -188,17 +188,29 @@ def test_precommit(self):
shell(["make", ".cookiecutter/state/setup-git"])
shell(["pre-commit", "run", "-a"])


@pytest.mark.usefixtures("default_baked_project")
class TestCookieMakeInstall(object):
@pytest.mark.usefixtures("conda_env")
def test_install(self):
"""Test `make install` command."""
with ch_dir(self.path):
shell(["make", "install"])
try:
shell(["make", "install"])

output = "".join(shell(["bash", "-c", "source .envrc && which python"]))
print(output)
output = "".join(shell(["bash", "-c", "source .envrc && which python"]))
print(output)

# Conda env activated by .envrc
assert f"{pytest.param.get('repo_name')}/bin/python" in output, output
# Conda env activated by .envrc
assert f"{pytest.param.get('repo_name')}/bin/python" in output, output
except CalledProcessError:
log_path = Path(".cookiecutter/state/conda-create.log")
if log_path.exists():
with log_path.open() as f:
print("conda-create.log:\n", f.read())
raise
finally:
p = shell(["make", "conda-remove"])


def shell(cmd: List[str]) -> List[str]:
Expand Down
2 changes: 1 addition & 1 deletion {{ cookiecutter.repo_name }}/environment.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
channels:
- defaults
- nodefaults
- conda-forge
dependencies:
- pip
Expand Down

0 comments on commit 9c3f162

Please sign in to comment.