Esempio n. 1
0
    def test_setup_build_docs(self, uploadhub, setupdir, tmpdir, monkeypatch):
        checkout = Checkout(uploadhub, setupdir)
        setupdir.join("setup.py").write(
            dedent("""
            from setuptools import setup
            setup(name="xyz", version="1.2.3")
        """))
        exported = checkout.export(tmpdir)
        assert exported.rootpath != exported.origrepo
        # we have to mock a bit unfortunately
        # to find out if the sphinx building popen command
        # is called with the exported directory instead of he original
        l = []
        old_popen_output = exported.hub.popen_output

        def mock_popen_output(args, **kwargs):
            if "build_sphinx" in args:
                l.append(kwargs)
            else:
                return old_popen_output(args, **kwargs)

        exported.hub.popen_output = mock_popen_output
        # now we can make the call
        exported.setup_build_docs()
        assert l[0]["cwd"] == exported.rootpath
Esempio n. 2
0
 def test_vcs_export_disabled(self, uploadhub, setupdir, tmpdir,
                              monkeypatch):
     monkeypatch.setattr(uploadhub.args, "novcs", True)
     checkout = Checkout(uploadhub, setupdir)
     assert not checkout.hasvcs
     exported = checkout.export(tmpdir)
     assert exported.rootpath == checkout.setupdir
Esempio n. 3
0
 def test_vcs_export_verify_setup(self, uploadhub, setupdir, tmpdir,
                                  monkeypatch):
     subdir = setupdir.mkdir("subdir")
     subdir.ensure("setup.py")
     checkout = Checkout(uploadhub, subdir)
     wc = tmpdir.mkdir("wc")
     exported = checkout.export(wc)
     with pytest.raises(SystemExit):
         exported.check_setup()
Esempio n. 4
0
 def test_export_attributes(self, uploadhub, setupdir, tmpdir, monkeypatch):
     checkout = Checkout(uploadhub, setupdir)
     setupdir.join("setup.py").write(
         dedent("""
         from setuptools import setup
         # some packages like numpy produce output during build, simulate:
         print("* foo, bar")
         setup(name="xyz", version="1.2.3")
     """))
     exported = checkout.export(tmpdir)
     name, version = exported.setup_name_and_version()
     assert name == "xyz"
     assert version == "1.2.3"
Esempio n. 5
0
 def test_vcs_export_setupdironly(self, uploadhub, setupdir, tmpdir,
                                  monkeypatch):
     monkeypatch.setattr(uploadhub.args, "setupdironly", True)
     checkout = Checkout(uploadhub, setupdir)
     assert checkout.rootpath == setupdir
     newrepo = tmpdir.mkdir("newrepo")
     result = checkout.export(newrepo)
     assert result.rootpath.join("file").check()
     assert result.rootpath.join("link").check()
     p = result.rootpath.join("setup.py")
     assert p.exists()
     if not sys.platform.startswith("win"):
         assert p.stat().mode & int("0777", 8) == int("0777", 8)
         assert result.rootpath.join("link").readlink() == '..'
     assert result.rootpath == newrepo.join(setupdir.basename)
Esempio n. 6
0
 def test_vcs_export(self, uploadhub, repo, setupdir, tmpdir, monkeypatch):
     checkout = Checkout(uploadhub, setupdir)
     assert checkout.rootpath == repo
     newrepo = tmpdir.mkdir("newrepo")
     result = checkout.export(newrepo)
     assert result.rootpath.join("file").check()
     assert result.rootpath.join("link").check()
     if not sys.platform.startswith("win"):
         assert result.rootpath.join("link").readlink() == ".."
     assert result.rootpath == newrepo.join(repo.basename).join(
         repo.bestrelpath(setupdir))
     # ensure we also copied repo meta info
     if repo.join(".hg").exists():
         assert newrepo.join(repo.basename).join(".hg").listdir()
     else:
         assert newrepo.join(repo.basename).join(".git").listdir()