[tracker-miners/sam/tracker-3.0-functional-tests: 4/5] functional-tests: Run with build dir as current working directory



commit a0ac3ba2a6b044d1e7e8f357501246c7462d1157
Author: Sam Thursfield <sam afuera me uk>
Date:   Wed Feb 12 01:37:15 2020 +0100

    functional-tests: Run with build dir as current working directory

 tests/functional-tests/extractor-flac-cuesheet.py | 10 +++++-----
 tests/functional-tests/meson.build                |  3 +--
 2 files changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/tests/functional-tests/extractor-flac-cuesheet.py 
b/tests/functional-tests/extractor-flac-cuesheet.py
index 46a9fb356..2497ae0de 100755
--- a/tests/functional-tests/extractor-flac-cuesheet.py
+++ b/tests/functional-tests/extractor-flac-cuesheet.py
@@ -20,7 +20,7 @@ Tests the FLAC+cuesheet extraction feature.
 """
 
 
-import os
+import pathlib
 import shutil
 import tempfile
 import unittest as ut
@@ -32,7 +32,7 @@ import fixtures
 
 class FlacCuesheetTest(fixtures.TrackerExtractTestCase):
     def spec(self, audio_path):
-        audio_uri = 'file://' + audio_path
+        audio_uri = audio_path.as_uri()
         return {
             '@type': ['nfo:Audio'],
             'nie:url': audio_uri,
@@ -83,10 +83,10 @@ class FlacCuesheetTest(fixtures.TrackerExtractTestCase):
 
     def test_external_cue_sheet(self):
         with tempfile.TemporaryDirectory() as tmpdir:
-            datadir = os.path.join(os.getcwd() + "/test-extraction-data")
-            shutil.copy(os.path.join(datadir, 'audio', 'cuesheet-test.cue'), tmpdir)
+            datadir = pathlib.Path(__file__).parent.joinpath('test-extraction-data')
+            shutil.copy(datadir.joinpath('audio', 'cuesheet-test.cue'), tmpdir)
 
-            audio_path = os.path.join(tmpdir, 'cuesheet-test.flac')
+            audio_path = pathlib.Path(tmpdir).joinpath('cuesheet-test.flac')
             datagenerator.create_test_flac(audio_path, duration=6*60)
 
             result = fixtures.get_tracker_extract_jsonld_output(
diff --git a/tests/functional-tests/meson.build b/tests/functional-tests/meson.build
index be574f9e9..b25a335fa 100644
--- a/tests/functional-tests/meson.build
+++ b/tests/functional-tests/meson.build
@@ -161,11 +161,10 @@ foreach t: extractor_tests
 endforeach
 
 foreach t: functional_tests
-  file = '@0@.py'.format(t)
+  file = meson.current_source_dir() / '@0@.py'.format(t)
   test(t, python,
     args: [file],
     env: test_env,
-    workdir: meson.current_source_dir(),
     suite: ['functional'] + test_suite,
     timeout: 120)
 endforeach


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]