File: python.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,190 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
'''
Python installation tests
'''

from __future__ import absolute_import

import sys
from pymol import testing

required_modules = [
    'Image',
    'numpy',
]

# when building on OSX with system python, some modules are not
# available by default. Only test for them if we build with our
# own python distribution which should ship all these modules.
if (not sys.executable.startswith('/System/Library/Frameworks/Python.framework/Versions/2.7')
        and not testing.PYMOL_EDU
        ):
    required_modules += [
#        'OpenGL', # we don't have it on Windows for PyMOL > 1.7.6
#        'matplotlib',
    ]

class TestSystem(testing.PyMOLTestCase):

    def testHasModules(self):
        failed = []
        for name in required_modules:
            try:
                __import__(name, level=0)
            except ImportError:
                failed.append(name)
        self.assertEqual(failed, [])

    @testing.requires_version('1.8.4')
    def testNoCmd(self):
        # https://github.com/schrodinger/pymol-open-source/issues/18
        self.skipTest("made non-fatal in 2.3.0")

        import pymol
        with self.assertRaises(pymol.CmdException):
            import cmd