Skip to content

Commit

Permalink
Merge pull request #23 from moduon/nogit
Browse files Browse the repository at this point in the history
fix: let it work without Git when it's not really needed
  • Loading branch information
sbidoul authored Jul 25, 2024
2 parents 0720ea9 + fb1f603 commit 922b704
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions news/23.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Let it work without Git when it's not required
2 changes: 1 addition & 1 deletion src/whool/buildapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def _scm_ls_files(addon_dir: Path) -> List[str]:
.strip()
.split("\n")
)
except subprocess.CalledProcessError as e:
except (subprocess.CalledProcessError, FileNotFoundError) as e:
raise NoScmFound() from e


Expand Down
15 changes: 15 additions & 0 deletions tests/test_build_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
from pathlib import Path
from zipfile import ZipFile

import pytest
from manifestoo_core.git_postversion import POST_VERSION_STRATEGY_NONE

from whool.buildapi import build_wheel
from whool.init import init_addon_dir

Expand Down Expand Up @@ -37,3 +40,15 @@ def test_build_wheel_without_scm(tmp_path: Path) -> None:
names = zf.namelist()
assert "odoo/addons/addon1/__manifest__.py" in names
assert "odoo/addons/addon1/pyproject.toml" not in names


def test_build_wheel_git_missing(
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
) -> None:
# Make sure we can't find git executable
monkeypatch.setenv("PATH", "/foo")
# Override strategy so Git is not needed
monkeypatch.setenv(
"WHOOL_POST_VERSION_STRATEGY_OVERRIDE", POST_VERSION_STRATEGY_NONE
)
test_build_wheel_without_scm(tmp_path)

0 comments on commit 922b704

Please sign in to comment.