summaryrefslogtreecommitdiff
path: root/tests/test_dep.py
blob: 114c1e8e80704ba40d150a20e89970cef0e100fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/python
import unittest
import yaml
from skdb.core import dep

class TestResolver(unittest.TestCase):
    def test_Dependency(self):
        g = dep.Resolver()
        fuel = dep.Dependency(g,name="fuel")
        transportation = dep.Dependency(g,name="transportation device")
        g.add_node(fuel)
        g.add_node(transportation)
        g.add_dependency("The Typical Approach", fuel, transportation)

        # a dependency of d1 is d2 (er, at least in name)
        self.assertTrue(g.dependencies((g.nodes())[0])==[fuel])
        print "grabbing the approaches to solving the 'transportation device': "
        print transportation.dependencysets

        print "\n\n\nyaml testing\n\n"
        print yaml.dump(g)
    def test_dependency_again(self):
        #say we don't have skdb.packages.screw or are not aware of it.
        screw1 = skdb.pymates.Part(name="screw")
        #choose from these: threading, thread rolling, thread milling, thread whirling
        dependency_set_build = skdb.dep.dependency_set(type="options")
        dependency_set_build.add("threading")
        dependency_set_build.add("thread rolling")
        dependency_set_build.add("thread milling")
        dependency_set_build.add("thread whirling")
        screw1.dependencies.add(type="build",set=dependency_set_build)
        dependency_set_build2 = skdb.dep.dependency_set(type="options")

    def test_Resolver(self):
        pass

if __name__ == '__main__':
    unittest.main()