Skip to content

Commit

Permalink
Make test suite location independant.
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidMansolino committed Jun 4, 2020
1 parent 453becc commit ac4657e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions tests/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ def mainTarget():
outFile.close()
errFile.close()

self.outFileName = os.environ['WEBOTS_HOME'] + os.sep + 'tests' + os.sep + 'webots_stdout.txt'
self.errFileName = os.environ['WEBOTS_HOME'] + os.sep + 'tests' + os.sep + 'webots_stderr.txt'
self.outFileName = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'webots_stdout.txt')
self.errFileName = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'webots_stderr.txt')
self.resetAttributes()

self.silent = silent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,9 @@ def initParserTest(self):
line.strip()
if line:
[world, expected] = shlex.split(line)
if os.path.normpath(world) == self.currentSimulationFilename.replace(os.environ['WEBOTS_HOME'] +
os.sep + 'tests' + os.sep, ''):
localWorldPath = self.currentSimulationFilename.replace(os.path.dirname(os.path.abspath(self.cwdPrefix)), '')
localWorldPath = localWorldPath.strip(os.sep)
if os.path.normpath(world) == localWorldPath:
found = True
if expected != 'VOID':
self.expectedString = expected
Expand Down
4 changes: 2 additions & 2 deletions tests/test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
testGroups = ['api', 'physics', 'protos', 'parser', 'rendering']

# global files
testsFolderPath = os.environ['WEBOTS_HOME'] + os.sep + 'tests' + os.sep
testsFolderPath = os.path.dirname(os.path.abspath(__file__)) + os.sep
outputFilename = testsFolderPath + 'output.txt'
defaultProjectPath = testsFolderPath + 'default' + os.sep
supervisorControllerName = 'test_suite_supervisor'
Expand Down Expand Up @@ -156,7 +156,7 @@ def appendToOutputFile(txt):
def executeMake():
"""Execute 'make release' to ensure every controller/plugin is compiled."""
curdir = os.getcwd()
os.chdir(os.path.join(os.environ['WEBOTS_HOME'], 'tests'))
os.chdir(testsFolderPath)
command = Command('make release -j%d' % multiprocessing.cpu_count())
command.run(silent=False)
os.chdir(curdir)
Expand Down

0 comments on commit ac4657e

Please sign in to comment.