-
-
Notifications
You must be signed in to change notification settings - Fork 222
Remove Warning/Error messages when using build
#1034
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
import pprint | ||
import subprocess | ||
import sys | ||
import textwrap | ||
|
||
from dataclasses import replace | ||
from importlib.metadata import EntryPoint | ||
|
@@ -17,6 +18,8 @@ | |
from setuptools_scm.integration import data_from_mime | ||
from setuptools_scm.version import meta | ||
|
||
from .wd_wrapper import WorkDir | ||
|
||
|
||
def test_data_from_mime_ignores_body() -> None: | ||
assert data_from_mime( | ||
|
@@ -97,6 +100,52 @@ def test_case_mismatch_on_windows_git(tmp_path: Path) -> None: | |
assert res is not None | ||
|
||
|
||
def test_fallback_message(wd: WorkDir, monkeypatch: pytest.MonkeyPatch) -> None: | ||
"""Check that no warning/error messages are normally outputted""" | ||
# setup a basic project that would not trigger any (other) warning/errors | ||
pyproject = """\ | ||
[build-system] | ||
requires = ["setuptools", "setuptools_scm"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "example" | ||
dynamic = ["version"] | ||
|
||
[tool.setuptools_scm] | ||
""" | ||
git_archival = """\ | ||
node: $Format:%H$ | ||
node-date: $Format:%cI$ | ||
describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$ | ||
""" | ||
wd.write("pyproject.toml", textwrap.dedent(pyproject)) | ||
wd.write(".git_archival.txt", textwrap.dedent(git_archival)) | ||
wd.write(".gitattributes", ".git_archival.txt export-subst") | ||
wd.write("README.md", "") | ||
wd("git init") | ||
wd("git config user.email user@host") | ||
wd("git config user.name user") | ||
wd.add_command = "git add ." | ||
wd.commit_command = "git commit -m test-{reason}" | ||
wd.add_and_commit() | ||
wd("git tag v0.1.0") | ||
version = wd.get_version() | ||
assert version == "0.1.0" | ||
|
||
# Run build and check messages | ||
monkeypatch.delenv("SETUPTOOLS_SCM_DEBUG") | ||
# with caplog.at_level(logging.WARN): | ||
res_build = subprocess.run( | ||
[sys.executable, "-m", "build", "-nx"], | ||
cwd=wd.cwd, | ||
capture_output=True, | ||
) | ||
assert res_build.returncode == 0 | ||
# Maybe there is a cleaner way to use caplog? | ||
assert not res_build.stderr | ||
Comment on lines
+139
to
+146
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a better way to run and check this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A hack that might be reasonable would be a fake object directly passed to the integration function There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You mean instead of Another option I was thinking is calling There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. as far as i remember, build has to start sub-processes for a build |
||
|
||
|
||
def test_entrypoints_load() -> None: | ||
d = distribution("setuptools-scm") | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.