summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/setuptools_scm/_overrides.py2
-rw-r--r--src/setuptools_scm/integration.py1
-rw-r--r--testing/test_basic_api.py27
3 files changed, 29 insertions, 1 deletions
diff --git a/src/setuptools_scm/_overrides.py b/src/setuptools_scm/_overrides.py
index 644e87d..00876e0 100644
--- a/src/setuptools_scm/_overrides.py
+++ b/src/setuptools_scm/_overrides.py
@@ -29,7 +29,7 @@ def _read_pretended_version_for(config: Configuration) -> Optional[ScmVersion]:
if pretended is None:
pretended = os.environ.get(PRETEND_KEY)
- if pretended is not None:
+ if pretended:
# we use meta here since the pretended version
# must adhere to the pep to begin with
return meta(tag=pretended, preformatted=True, config=config)
diff --git a/src/setuptools_scm/integration.py b/src/setuptools_scm/integration.py
index 1a23f07..7d399a3 100644
--- a/src/setuptools_scm/integration.py
+++ b/src/setuptools_scm/integration.py
@@ -20,6 +20,7 @@ def _warn_on_old_setuptools(_version=setuptools.__version__):
ERROR: setuptools=={_version} is used in combination with setuptools_scm>=6.x
Your build configuration is incomplete and previously worked by accident!
+setuptools_scm requires setuptools>=45
This happens as setuptools is unable to replace itself when a activated build dependency
diff --git a/testing/test_basic_api.py b/testing/test_basic_api.py
index 55bf346..02ea82f 100644
--- a/testing/test_basic_api.py
+++ b/testing/test_basic_api.py
@@ -90,6 +90,33 @@ setup(use_scm_version={"fallback_version": "12.34"})
assert res == "12.34"
+def test_empty_pretend_version(tmpdir, monkeypatch):
+ monkeypatch.delenv("SETUPTOOLS_SCM_DEBUG")
+ monkeypatch.setenv("SETUPTOOLS_SCM_PRETEND_VERSION", "")
+ p = tmpdir.ensure("sub/package", dir=1)
+ p.join("setup.py").write(
+ """from setuptools import setup
+setup(use_scm_version={"fallback_version": "12.34"})
+"""
+ )
+ res = do((sys.executable, "setup.py", "--version"), p)
+ assert res == "12.34"
+
+
+def test_empty_pretend_version_named(tmpdir, monkeypatch):
+ monkeypatch.delenv("SETUPTOOLS_SCM_DEBUG")
+ monkeypatch.setenv("SETUPTOOLS_SCM_PRETEND_VERSION", "1.23")
+ monkeypatch.setenv("SETUPTOOLS_SCM_PRETEND_VERSION_FOR_MYSCM", "")
+ p = tmpdir.ensure("sub/package", dir=1)
+ p.join("setup.py").write(
+ """from setuptools import setup
+setup(name="myscm", use_scm_version={"fallback_version": "12.34"})
+"""
+ )
+ res = do((sys.executable, "setup.py", "--version"), p)
+ assert res == "12.34"
+
+
@pytest.mark.parametrize(
"version", ["1.0", "1.2.3.dev1+ge871260", "1.2.3.dev15+ge871260.d20180625", "2345"]
)