66import odml .validation
77import odml .terminology
88from . import test_samplefile as samplefile
9+ from .util import TEST_RESOURCES_DIR as RES_DIR
910
1011try :
1112 from StringIO import StringIO
@@ -19,7 +20,6 @@ class TestValidation(unittest.TestCase):
1920
2021 def setUp (self ):
2122 self .doc = samplefile .SampleFileCreator ().create_document ()
22- self .dir_path = os .path .dirname (os .path .realpath (__file__ ))
2323
2424 @staticmethod
2525 def filter_repository_errors (errors ):
@@ -405,7 +405,7 @@ def test_load_section_xml(self):
405405 Test if loading xml document raises validation errors for Sections with undefined type.
406406 """
407407
408- path = os .path .join (self . dir_path , "resources" , "validation_section.xml" )
408+ path = os .path .join (RES_DIR , "validation_section.xml" )
409409 doc = odml .load (path )
410410
411411 self .load_section_validation (doc )
@@ -415,7 +415,7 @@ def test_load_section_json(self):
415415 Test if loading json document raises validation errors for Sections with undefined type.
416416 """
417417
418- path = os .path .join (self . dir_path , "resources" , "validation_section.json" )
418+ path = os .path .join (RES_DIR , "validation_section.json" )
419419 doc = odml .load (path , "JSON" )
420420
421421 self .load_section_validation (doc )
@@ -425,7 +425,7 @@ def test_load_section_yaml(self):
425425 Test if loading yaml document raises validation errors for Sections with undefined type.
426426 """
427427
428- path = os .path .join (self . dir_path , "resources" , "validation_section.yaml" )
428+ path = os .path .join (RES_DIR , "validation_section.yaml" )
429429 doc = odml .load (path , "YAML" )
430430
431431 self .load_section_validation (doc )
@@ -459,7 +459,7 @@ def test_load_dtypes_xml(self):
459459 for Properties with undefined dtypes.
460460 """
461461
462- path = os .path .join (self . dir_path , "resources" , "validation_dtypes.xml" )
462+ path = os .path .join (RES_DIR , "validation_dtypes.xml" )
463463 doc = odml .load (path )
464464 self .load_dtypes_validation (doc )
465465
@@ -469,7 +469,7 @@ def test_load_dtypes_json(self):
469469 for Properties with undefined dtypes.
470470 """
471471
472- path = os .path .join (self . dir_path , "resources" , "validation_dtypes.json" )
472+ path = os .path .join (RES_DIR , "validation_dtypes.json" )
473473 doc = odml .load (path , "JSON" )
474474 self .load_dtypes_validation (doc )
475475
@@ -479,6 +479,6 @@ def test_load_dtypes_yaml(self):
479479 for Properties with undefined dtypes.
480480 """
481481
482- path = os .path .join (self . dir_path , "resources" , "validation_dtypes.yaml" )
482+ path = os .path .join (RES_DIR , "validation_dtypes.yaml" )
483483 doc = odml .load (path , "YAML" )
484484 self .load_dtypes_validation (doc )
0 commit comments