def _check_hg_git(): if not has_command("hg", warn=False): pytest.skip("hg executable not found") python_hg, err, ret = do_ex("hg debuginstall --template {pythonexe}") if ret: skip_no_hggit = True else: out, err, ret = do_ex([python_hg.strip(), "-c", "import hggit"]) skip_no_hggit = bool(ret) if skip_no_hggit: pytest.skip("hg-git not installed")
def test_pkginfo_noscmroot(tmpdir, monkeypatch): """if we are indeed a sdist, the root does not apply""" monkeypatch.delenv("SETUPTOOLS_SCM_DEBUG") # we should get the version from pkg-info if git is broken p = tmpdir.ensure("sub/package", dir=1) tmpdir.mkdir(".git") p.join("setup.py").write("from setuptools import setup;" 'setup(use_scm_version={"root": ".."})') _, stderr, ret = do_ex((sys.executable, "setup.py", "--version"), p) assert "setuptools-scm was unable to detect version for" in stderr assert ret == 1 p.join("PKG-INFO").write("Version: 1.0") res = do((sys.executable, "setup.py", "--version"), p) assert res == "1.0" try: do("git init", p.dirpath()) except FileNotFoundError: pass else: res = do((sys.executable, "setup.py", "--version"), p) assert res == "0.1.dev0"
def test_pkginfo_noscmroot(tmpdir, monkeypatch): """if we are indeed a sdist, the root does not apply""" monkeypatch.delenv("SETUPTOOLS_SCM_DEBUG") # we should get the version from pkg-info if git is broken p = tmpdir.ensure('sub/package', dir=1) tmpdir.mkdir('.git') p.join('setup.py').write('from setuptools import setup;' 'setup(use_scm_version={"root": ".."})') _, stderr, ret = do_ex('python setup.py --version', p) assert 'setuptools-scm was unable to detect version for' in stderr assert ret == 1 p.join("PKG-INFO").write('Version: 1.0') res = do('python setup.py --version', p) assert res == '1.0' do('git init', p.dirpath()) res = do('python setup.py --version', p) assert res == '1.0'
def test_pkginfo_noscmroot(tmpdir, monkeypatch): """if we are indeed a sdist, the root does not apply""" monkeypatch.delenv("SETUPTOOLS_SCM_DEBUG") # we should get the version from pkg-info if git is broken p = tmpdir.ensure('sub/package', dir=1) tmpdir.mkdir('.git') p.join('setup.py').write( 'from setuptools import setup;' 'setup(use_scm_version={"root": ".."})') _, stderr, ret = do_ex('python setup.py --version', p) assert 'setuptools-scm was unable to detect version for' in stderr assert ret == 1 p.join("PKG-INFO").write('Version: 1.0') res = do('python setup.py --version', p) assert res == '1.0' do('git init', p.dirpath()) res = do('python setup.py --version', p) assert res == '1.0'