File: externing.py

package info (click to toggle)
pymol 3.1.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 74,084 kB
  • sloc: cpp: 482,660; python: 89,328; ansic: 29,512; javascript: 6,792; sh: 84; makefile: 25
file content (44 lines) | stat: -rw-r--r-- 1,245 bytes parent folder | download
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
import os
import sys
from pymol import cmd, testing, stored

def touch(filename):
    open(filename, 'ab').close()

class TestExterning(testing.PyMOLTestCase):

    def testCdLsPwd(self):
        with testing.mkdtemp() as path:
            cmd.cd(path)
            if sys.platform == 'win32':
                import ctypes
                def get_long_path_name(path):
                    buf = ctypes.create_unicode_buffer(260)
                    ctypes.windll.kernel32.GetLongPathNameW(path, buf, len(buf))
                    return buf.value
                self.assertEqual(get_long_path_name(os.getcwd()),
                                 get_long_path_name(os.path.realpath(path)))
            else:
                self.assertEqual(os.getcwd(),
                        os.path.realpath(path))

            touch('foo1.txt')
            touch('foo2.txt')
            touch('foo3.bin')

            cmd.feedback("disable", "python", "output")

            cmd.pwd()
            # no test of output possible

            cmd.ls('*.txt')
            # no test of output possible

    def testPaste(self):
        cmd.paste
        # partly functional command (?)

    def testSystem(self):
        cmd.system
        self.skipTest("TODO")