__init__.py
Go to the documentation of this file.
1 # coding=utf-8
2 import os
3 from distutils.version import LooseVersion
4 import pytest
5 import rospy
6 
7 
8 def get_output_file(argv):
9  for arg in argv:
10  if arg.startswith('--gtest_output'):
11  return arg.split('=xml:')[1]
12 
13  raise RuntimeError('No output file has been passed')
14 
15 
16 def create_cache_dir_args(version, output_file):
17  # disable cache for Pytest < 3.2
18  if LooseVersion("3.5.0") > LooseVersion(version):
19  cache_dir_arg = '-p no:cacheprovider'
20  else:
21  root_dir = os.path.dirname(output_file)
22  cache_dir_arg = '--rootdir={}'.format(root_dir)
23  return cache_dir_arg.split(' ')
24 
25 
26 def run_pytest(argv):
27  output_file = get_output_file(argv)
28  test_module = rospy.get_param('test_module')
29  module_path = os.path.realpath(test_module)
30  cache_dir_args = create_cache_dir_args(pytest.__version__, output_file)
31 
32  return pytest.main([module_path, '--junitxml={}'.format(output_file)] + cache_dir_args)
def run_pytest(argv)
Definition: __init__.py:26
def create_cache_dir_args(version, output_file)
Definition: __init__.py:16
def get_output_file(argv)
Definition: __init__.py:8


ros_pytest
Author(s):
autogenerated on Mon Jun 10 2019 14:42:05