Skip to content

Commit

Permalink
added a failing test example, for #35.
Browse files Browse the repository at this point in the history
  • Loading branch information
toumorokoshi committed Dec 20, 2017
1 parent 9508484 commit f5620f4
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 1 deletion.
2 changes: 1 addition & 1 deletion makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
test:
./uranium/scripts/uranium_standalone --uranium-dir=. test ${ARGS} -v -x
./uranium/scripts/uranium_standalone --uranium-dir=. test ${ARGS} -v -x -k develop_package_imports

build:
./uranium/scripts/uranium_standalone --uranium-dir=.
Expand Down
Empty file.
10 changes: 10 additions & 0 deletions tests/example_package/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env python
import os
import sys
from setuptools import setup, find_packages

setup(name='example',
description='example',
packages=find_packages(),
install_requires=[],
classifiers=[])
30 changes: 30 additions & 0 deletions tests/test_packages_full.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,14 @@ def main(build):
assert exist == False
""".strip()

import os
from uranium.scripts import execute_script
from .conftest import URANIUM_SOURCE_ROOT

EXAMPLE_PACKAGE_PATH = os.path.join(
os.path.dirname(__file__), "example_package"
)


def test_install(tmpdir):
# we need to create a virtualenv
Expand Down Expand Up @@ -152,3 +157,28 @@ def main(build):
print("stdout:\n" + str(out))
print("stderr:\n" + str(err))
assert code == 0


def test_develop_package_imports(tmpdir):
"""
a develop package should be importable immediately after installation
"""

UBUILD = """
import os
def main(build):
build.packages.install("{package}", develop=True)
import example
""".format(package=EXAMPLE_PACKAGE_PATH).strip()

# we need to create a virtualenv
tmpdir.join("ubuild.py").write(UBUILD)
code, out, err = execute_script(
"uranium_standalone", "--uranium-dir", URANIUM_SOURCE_ROOT,
cwd=tmpdir.strpath
)
print("stdout:\n" + str(out))
print("stderr:\n" + str(err))
assert code == 0

0 comments on commit f5620f4

Please sign in to comment.