converter/test/conftest.py
Go to the documentation of this file.
1 
4 
5 """Automatic testing for qicore behavior's converter"""
6 
7 import os
8 import pytest
9 
10 
11 OPTIONS_LIST = [
12  "--old-xar",
13  "--new-xar",
14  "--xml",
15  "--bhs",
16  "--anim",
17  "--fld"
18  ]
19 
20 
21 def pytest_addoption(parser):
22  parser.addoption("--old-xar", action="store", default="",
23  help="specify path of an old xar to test:\n"
24  + "- old format behavior.xar\n")
25  parser.addoption("--new-xar", action="store", default="",
26  help="specify path of a new xar to test:\n"
27  + "- new format behavior.xar\n")
28  parser.addoption("--xml", action="store", default="",
29  help="specify path of a behavior interface to test:\n"
30  + "- new format <box interface>.xml\n")
31  parser.addoption("--bhs", action="store", default="",
32  help="specify path of a behavior sequence to test:\n"
33  + "- new format <behavior sequence>.bhs\n")
34  parser.addoption("--anim", action="store", default="",
35  help="specify path of a animation to test:\n"
36  + "- new format <animation>.anim\n")
37  parser.addoption("--fld", action="store", default="",
38  help="specify path of a flow diagram to test:\n"
39  + "- new format <flow diagram>.fld\n")
40 
41 
43  args = []
44  currentDir = os.path.dirname(os.path.abspath(__file__))
45  currentDir = os.path.realpath(os.path.join(currentDir,
46  "..",
47  "..",
48  ".."))
49 
50  args.append(os.path.join(currentDir,
51  "xarconverter",
52  "tests",
53  "behavior1",
54  "behavior.xar"))
55  args.append(os.path.join(currentDir,
56  "xarconverter",
57  "tests",
58  "behavior2",
59  "behavior.xar"))
60  args.append(os.path.join(currentDir,
61  "xarconverter",
62  "tests",
63  "behavior2",
64  "B_0_0_Hello1.xml"))
65  args.append(os.path.join(currentDir,
66  "xarconverter",
67  "tests",
68  "behavior2",
69  "B_0_0_Hello1.bhs"))
70  args.append(os.path.join(currentDir,
71  "xarconverter",
72  "tests",
73  "behavior2",
74  "B_0_0_Hello1.anim"))
75  args.append(os.path.join(currentDir,
76  "xarconverter",
77  "tests",
78  "behavior2",
79  "B_0_0_B1_0_FaceLeds0.fld"))
80  return args
81 
82 
83 @pytest.fixture
84 def parse_args(request):
85  """ extract args
86  """
87  args = []
88  str_arg = ""
89  fallback_args = _default_args()
90 
91  for i in range(len(OPTIONS_LIST)):
92  str_arg = request.config.getoption(OPTIONS_LIST[i])
93  if not str_arg:
94  args.append(fallback_args[i])
95  else:
96  args.append(os.path.abspath(str_arg))
97 
98  return args
converter.test.conftest.pytest_addoption
def pytest_addoption(parser)
Definition: converter/test/conftest.py:21
converter.test.conftest._default_args
def _default_args()
Definition: converter/test/conftest.py:42
converter.test.conftest.parse_args
def parse_args(request)
Definition: converter/test/conftest.py:84


naoqi_libqicore
Author(s): Aldebaran
autogenerated on Wed Sep 14 2022 02:22:41