Commit a4232484 authored by Samuel GAIST's avatar Samuel GAIST

[test][algorithm_dependencies] Fix "uses" check and handling

parent b87954eb
...@@ -68,14 +68,14 @@ def test_dependencies(): ...@@ -68,14 +68,14 @@ def test_dependencies():
alg = Algorithm(tmp_prefix, name) alg = Algorithm(tmp_prefix, name)
nose.tools.assert_true(alg.valid, "\n * %s" % "\n * ".join(alg.errors)) nose.tools.assert_true(alg.valid, "\n * %s" % "\n * ".join(alg.errors))
nose.tools.eq_(len(alg.uses), 0) nose.tools.assert_is_none(alg.uses)
nose.tools.eq_(len(alg.libraries), 0) nose.tools.eq_(len(alg.libraries), 0)
l_dep = Library(tmp_prefix, dep_name) l_dep = Library(tmp_prefix, dep_name)
nose.tools.assert_true(l_dep.valid, "\n * %s" % "\n * ".join(l_dep.errors)) nose.tools.assert_true(l_dep.valid, "\n * %s" % "\n * ".join(l_dep.errors))
# check modification # check modification
alg.uses["dep1"] = dep_name alg.uses = {"dep1": dep_name}
alg.write() alg.write()
alg = Algorithm(tmp_prefix, name) alg = Algorithm(tmp_prefix, name)
nose.tools.assert_true(alg.valid, "\n * %s" % "\n * ".join(alg.errors)) nose.tools.assert_true(alg.valid, "\n * %s" % "\n * ".join(alg.errors))
...@@ -115,14 +115,28 @@ def test_invalid_dependencies(): ...@@ -115,14 +115,28 @@ def test_invalid_dependencies():
alg = Algorithm(tmp_prefix, name) alg = Algorithm(tmp_prefix, name)
nose.tools.assert_true(alg.valid, "\n * %s" % "\n * ".join(alg.errors)) nose.tools.assert_true(alg.valid, "\n * %s" % "\n * ".join(alg.errors))
nose.tools.eq_(len(alg.uses), 0) nose.tools.assert_is_none(alg.uses)
nose.tools.eq_(len(alg.libraries), 0) nose.tools.eq_(len(alg.libraries), 0)
l_dep = Library(tmp_prefix, "errors/invalid_dep/1") l_dep = Library(tmp_prefix, "errors/invalid_dep/1")
nose.tools.assert_true(l_dep.valid, "\n * %s" % "\n * ".join(l_dep.errors)) nose.tools.assert_true(l_dep.valid, "\n * %s" % "\n * ".join(l_dep.errors))
alg.uses["dep"] = dep_name alg.uses = {"dep": dep_name}
alg.write() alg.write()
alg = Algorithm(tmp_prefix, name) alg = Algorithm(tmp_prefix, name)
nose.tools.assert_false(alg.valid) nose.tools.assert_false(alg.valid)
nose.tools.assert_not_equal(alg.errors[0].find("differs from current language"), -1) nose.tools.assert_not_equal(alg.errors[0].find("differs from current language"), -1)
@nose.tools.with_setup(teardown=cleanup)
def test_invalid_dependency_setup():
name = "user/for_dep/1"
dep_name = "user/dep/1"
copy_objects(name, dep_name)
alg = Algorithm(tmp_prefix, name)
nose.tools.assert_true(alg.valid, "\n * %s" % "\n * ".join(alg.errors))
nose.tools.assert_is_none(alg.uses)
with nose.tools.assert_raises(RuntimeError):
alg.uses = "dummy"
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