Virgil Dupras committed 9d2a8be

Use the py.path-based TestData from hscommon and added a 'testdata' funcarg.

Comments (0)

Files changed (4)

-16ed0f68af5903fe1d731021f46c9319c05ae4a0 hscommon
+e4f360a32f7b5bf48978d2c7ee7342c0cb6efd9b hscommon
 d927dd68210644d8f987adb8d149d0e13bdc10e0 qtlib
 import yaml
 import pytest
+import py.path
-from hscommon.testutil import CallLogger, TestApp as TestAppBase
-from hsutil.path import Path
-from hsutil.testutil import TestData as TestDataBase
+from hscommon.testutil import CallLogger, TestApp as TestAppBase, TestData
 from gui.hit_table import HitTable
 from gui.main_window import MainWindow
 from gui.time_slider_label import TimeSliderLabel
 from gui.visit_table import VisitTable
-class TestData(TestDataBase):
-    @classmethod
-    def datadirpath(cls):
-        return Path(__file__)[:-1] + 'testdata'
+def get_testdata():
+    dirpath = py.path.local(__file__).dirpath()
+    return TestData(dirpath.join('testdata'))
 def tmpfile():
     logpath = pytest.ensuretemp('wgtest')
 class TestConf(dict):
     def add_testdata_log(self, logname, sitename=None):
-        logpath = TestData.filepath(logname)
-        self.add_log(logpath, sitename)
+        logpath = get_testdata().filepath(logname)
+        self.add_log(str(logpath), sitename)
     def add_log_lines(self, lines, sitename=None):
         # this path is not always different on every call, so we have to find a temp filename in


+# Created By: Virgil Dupras
+# Created On: 2010-12-20
+# Copyright 2010 Hardcoded Software (
+# This software is licensed under the "BSD" License as described in the "LICENSE" file, 
+# which should be included with this package. The terms are also available at 
+from .base import get_testdata
+def pytest_funcarg__testdata(request):
+    return get_testdata()


 # which should be included with this package. The terms are also available at 
-import os.path as op
 from hsutil.testutil import eq_
-from .base import TestApp, TestConf, TestData
+from .base import TestApp, TestConf
 def test_multiple_log_files_different_visits():
     eq_(len(app.vtable), 2)
-def test_support_glob_pattern():
+def test_support_glob_pattern(testdata):
     # If the logpath is a glob pattern, open all files matching the pattern.
     app, conf = TestApp(), TestConf()
-    folderpath = TestData.filepath('twofiles')
-    conf.add_log(op.join(folderpath, '*.log'))
+    folderpath = testdata.filepath('twofiles')
+    conf.add_log(str(folderpath.join('*.log')))
     eq_(len(app.vtable), 2)