6
6
import odml .validation
7
7
import odml .terminology
8
8
from . import test_samplefile as samplefile
9
+ from .util import TEST_RESOURCES_DIR as RES_DIR
9
10
10
11
try :
11
12
from StringIO import StringIO
@@ -19,7 +20,6 @@ class TestValidation(unittest.TestCase):
19
20
20
21
def setUp (self ):
21
22
self .doc = samplefile .SampleFileCreator ().create_document ()
22
- self .dir_path = os .path .dirname (os .path .realpath (__file__ ))
23
23
24
24
@staticmethod
25
25
def filter_repository_errors (errors ):
@@ -405,7 +405,7 @@ def test_load_section_xml(self):
405
405
Test if loading xml document raises validation errors for Sections with undefined type.
406
406
"""
407
407
408
- path = os .path .join (self . dir_path , "resources" , "validation_section.xml" )
408
+ path = os .path .join (RES_DIR , "validation_section.xml" )
409
409
doc = odml .load (path )
410
410
411
411
self .load_section_validation (doc )
@@ -415,7 +415,7 @@ def test_load_section_json(self):
415
415
Test if loading json document raises validation errors for Sections with undefined type.
416
416
"""
417
417
418
- path = os .path .join (self . dir_path , "resources" , "validation_section.json" )
418
+ path = os .path .join (RES_DIR , "validation_section.json" )
419
419
doc = odml .load (path , "JSON" )
420
420
421
421
self .load_section_validation (doc )
@@ -425,7 +425,7 @@ def test_load_section_yaml(self):
425
425
Test if loading yaml document raises validation errors for Sections with undefined type.
426
426
"""
427
427
428
- path = os .path .join (self . dir_path , "resources" , "validation_section.yaml" )
428
+ path = os .path .join (RES_DIR , "validation_section.yaml" )
429
429
doc = odml .load (path , "YAML" )
430
430
431
431
self .load_section_validation (doc )
@@ -459,7 +459,7 @@ def test_load_dtypes_xml(self):
459
459
for Properties with undefined dtypes.
460
460
"""
461
461
462
- path = os .path .join (self . dir_path , "resources" , "validation_dtypes.xml" )
462
+ path = os .path .join (RES_DIR , "validation_dtypes.xml" )
463
463
doc = odml .load (path )
464
464
self .load_dtypes_validation (doc )
465
465
@@ -469,7 +469,7 @@ def test_load_dtypes_json(self):
469
469
for Properties with undefined dtypes.
470
470
"""
471
471
472
- path = os .path .join (self . dir_path , "resources" , "validation_dtypes.json" )
472
+ path = os .path .join (RES_DIR , "validation_dtypes.json" )
473
473
doc = odml .load (path , "JSON" )
474
474
self .load_dtypes_validation (doc )
475
475
@@ -479,6 +479,6 @@ def test_load_dtypes_yaml(self):
479
479
for Properties with undefined dtypes.
480
480
"""
481
481
482
- path = os .path .join (self . dir_path , "resources" , "validation_dtypes.yaml" )
482
+ path = os .path .join (RES_DIR , "validation_dtypes.yaml" )
483
483
doc = odml .load (path , "YAML" )
484
484
self .load_dtypes_validation (doc )
0 commit comments