3131import unittest , os , sys , shutil
3232from ..reaction import Reaction
3333from .statmech import StatMech
34+ from ..utils .paths import project_root , test_data_dir , test_dir
3435import rmgpy .reaction
3536import rmgpy .kinetics
3637
@@ -40,12 +41,12 @@ def setUp(self):
4041 self .reaction .get_labeled_reaction ()
4142 self .reaction .generate_reactants_and_products ()
4243
43- directory = os . path . expandvars ( "$AUTOTST/test" )
44+ directory = test_dir ( )
4445 if not os .path .exists (os .path .join (directory , "ts" , self .reaction .label )):
4546 os .makedirs (os .path .join (directory , "ts" , self .reaction .label ))
4647 if not os .path .exists (os .path .join (directory , "ts" , self .reaction .label , self .reaction .label + ".log" )):
4748 shutil .copy (
48- os . path . join ( directory , "bin" , "log-files" , self .reaction .label + " _forward_0.log") ,
49+ test_data_dir () / f" { self .reaction .label } _forward_0.log" ,
4950 os .path .join (directory , "ts" , self .reaction .label , self .reaction .label + ".log" )
5051 )
5152
@@ -55,24 +56,24 @@ def setUp(self):
5556 os .makedirs (os .path .join (directory , "species" , smiles ))
5657 if not os .path .exists (os .path .join (directory , "species" , smiles , smiles + ".log" )):
5758 shutil .copy (
58- os . path . join ( directory , "bin" , "log-files" , smiles + " _0.log") ,
59+ test_data_dir () / f" { smiles } _0.log" ,
5960 os .path .join (directory , "species" , smiles , smiles + ".log" )
6061 )
6162
6263 self .statmech = StatMech (
6364 reaction = self .reaction ,
64- directory = directory
65+ directory = str ( directory )
6566 )
6667
6768 def tearDown (self ):
6869 try :
69- directory = os . path . expandvars ( "$AUTOTST/test" )
70+ directory = test_dir ( )
7071 if os .path .exists (os .path .join (directory , "ts" )):
7172 shutil .rmtree (os .path .join (directory , "ts" ))
7273 if os .path .exists (os .path .join (directory , "species" )):
7374 shutil .rmtree (os .path .join (directory , "species" ))
7475
75- for head , _ , files in os .walk (os . path . expandvars ( "$AUTOTST" )):
76+ for head , _ , files in os .walk (project_root ( )):
7677 for fi in files :
7778 if fi .endswith (".symm" ):
7879 os .remove (os .path .join (head , fi ))
@@ -176,4 +177,4 @@ def test_set_results(self):
176177if __name__ == "__main__" :
177178 unittest .main (testRunner = unittest .TextTestRunner (verbosity = 2 ))
178179
179-
180+
0 commit comments