sources for test_api.py [rev. unknown]
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
from py import path, test
import py
from py.__.path.svn.testing.test_wccommand import getrepowc
class TestAPI:
    def setup_class(cls): 
        cls.root = py.test.ensuretemp(cls.__name__) 
    def repr_eval_test(self, p):
        r = repr(p)
        from py.path import local,svnurl, svnwc
        y = eval(r)
        assert y == p
    def test_defaultlocal(self):
        p = path.local()
        assert hasattr(p, 'atime')
        #assert hasattr(p, 'group') # XXX win32? 
        assert hasattr(p, 'setmtime')
        assert p.check()
        assert p.check(local=1)
        assert p.check(svnwc=0)
        assert not p.check(svnwc=1)
        self.repr_eval_test(p)
        #assert p.std.path()
    def test_local(self):
        p = path.local()
        assert hasattr(p, 'atime')
        assert hasattr(p, 'setmtime')
        assert p.check()
        assert p.check(local=1)
        self.repr_eval_test(p)
    def test_svnurl(self):
        p = path.svnurl('http://codespeak.net/svn/py')
        assert p.check(svnurl=1)
        self.repr_eval_test(p)
    def test_svnwc(self):
        p = path.svnwc(self.root)
        assert p.check(svnwc=1)
        self.repr_eval_test(p)
    #def test_fspy(self):
    #    p = path.py('smtplib.SMTP')
    #    self.repr_eval_test(p)
if __name__ == '__main__':
    test.main()