File: async_builds.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 (30 lines) | stat: -rw-r--r-- 838 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
'''
Testing setting/getting properties for different types
'''

import random
import unittest
from pymol import cmd, testing

max_threads = cmd.get_setting_int('max_threads')

@testing.requires('gui', 'no_run_all', 'multicore')
class TestAsyncBuilds(testing.PyMOLTestCase):

    @testing.foreach.product(['surface', 'cartoon'], [0, 1])
    def testAsyncBuilds(self, rep, async_builds):
        target = "1aon"
        if async_builds:
            msg = '%s cpus' % max_threads
        else:
            msg = '1 cpu'
        cmd.set("async_builds", async_builds)
    
        cmd.load(self.datafile('1aon.pdb.gz'), target)
        for x in cmd.get_chains():
            cmd.create("Chain_%s" % x, target + " & c. " + x)
        cmd.delete(target)

        with self.timing('%s' % msg):
            cmd.show_as(rep)
            cmd.draw()