Commit 3ff6789b authored by Jason R. Coombs's avatar Jason R. Coombs

Use py.path objects for cleaner setup

parent 656a5f3b
...@@ -688,30 +688,30 @@ class TestNamespaces: ...@@ -688,30 +688,30 @@ class TestNamespaces:
Regression test for https://bitbucket.org/pypa/setuptools/issues/207 Regression test for https://bitbucket.org/pypa/setuptools/issues/207
""" """
real_tmpdir = str(symlinked_tmpdir.realpath()) tmpdir = symlinked_tmpdir
tmpdir = str(symlinked_tmpdir) site_dirs = (
site_pkgs = ["site-pkgs", "site-pkgs2", "site-pkgs3"] tmpdir / "site-pkgs",
tmpdir / "site-pkgs2",
tmpdir / "site-pkgs3",
)
ns_str = "__import__('pkg_resources').declare_namespace(__name__)\n" ns_str = "__import__('pkg_resources').declare_namespace(__name__)\n"
vers_str = "__version__ = %r" vers_str = "__version__ = %r"
for idx, site in enumerate(site_pkgs): for idx, site in enumerate(site_dirs):
if idx > 0: if idx > 0:
sys.path.append(os.path.join(tmpdir, site)) sys.path.append(str(site))
os.makedirs(os.path.join(tmpdir, site, "nspkg", "subpkg")) nspkg = site / 'nspkg'
with open(os.path.join(tmpdir, site, "nspkg", subpkg = nspkg / 'subpkg'
"__init__.py"), "w") as f: subpkg.ensure_dir()
f.write(ns_str) (nspkg / '__init__.py').write_text(ns_str, encoding='utf-8')
(subpkg / '__init__.py').write_text(vers_str % (idx + 1), encoding='utf-8')
with open(os.path.join(tmpdir, site, "nspkg", "subpkg",
"__init__.py"), "w") as f:
f.write(vers_str % (idx + 1))
import nspkg.subpkg import nspkg.subpkg
import nspkg import nspkg
expected = [ expected = [
os.path.join(real_tmpdir, site, "nspkg") str(site.realpath() / 'nspkg')
for site in site_pkgs for site in site_dirs
] ]
assert nspkg.__path__ == expected assert nspkg.__path__ == expected
assert nspkg.subpkg.__version__ == 1 assert nspkg.subpkg.__version__ == 1
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment