File: testcontext.py

package info (click to toggle)
drmaa 0.7.9-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 360 kB
  • sloc: python: 1,295; makefile: 130; sh: 34
file content (28 lines) | stat: -rw-r--r-- 640 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
'''
Tests related to with using context managers.
'''

from __future__ import absolute_import, print_function, unicode_literals

from drmaa import Session


def test_with_session():
    """'with' statement works with Session"""
    with Session() as s:
        print(s.version)
        print(s.contact)
        print(s.drmsInfo)
        print(s.drmaaImplementation)


def test_with_jt():
    """'with' statement works with JobTemplate"""
    s = Session()
    s.initialize()
    with s.createJobTemplate() as jt:
        jt.remoteCommand = 'sleep'
        jt.args = ['10']
        jid = s.runJob(jt)
        print(s.wait(jid))
    s.exit()