Debian Codegraph @

pbcommand/testkit/base_utils.py

raw symbols SCIP
1 import os
2 import tempfile
3
4 HAS_PBCORE = False
5
6 try:
7 import pbcore
8 HAS_PBCORE = True
9 except ImportError:
10 HAS_PBCORE = False
11
12
13 def pbcore_skip_msg(msg=None):
14 msg = "" if msg is None else msg
15 return "" if HAS_PBCORE else "pbcore is not installed. {m}".format(m=msg)
16
17
18 def get_temp_file(suffix, dir_):
19 t = tempfile.NamedTemporaryFile(suffix=suffix, delete=False, dir=dir_)
20 t.close()
21 return t.name
22
23
24 def get_temp_dir(suffix=""):
25 """This will make subdir in the root tmp dir"""
26 return tempfile.mkdtemp(dir=None, suffix=suffix)
27
28
29 def pb_requirements(*reqs):
30 """
31 Method decorator for specifying linked JIRA issues.
32 """
33 def decorator(test_item):
34 test_item.__pb_requirements__ = list(reqs)
35 return test_item
36 return decorator