diff --git a/hexrd/config/findorientations.py b/hexrd/config/findorientations.py index cd6b1effc..6184f8539 100644 --- a/hexrd/config/findorientations.py +++ b/hexrd/config/findorientations.py @@ -290,7 +290,9 @@ def file(self): 'find_orientations:orientation_maps:file', default=None ) - if temp is not None: + if temp is None: + return None + else: ptemp = Path(temp) if ptemp.is_absolute(): mapf = ptemp diff --git a/tests/config/test_find_orientations.py b/tests/config/test_find_orientations.py index 8ea3abc6b..c51b245f5 100644 --- a/tests/config/test_find_orientations.py +++ b/tests/config/test_find_orientations.py @@ -9,6 +9,9 @@ """ analysis_name: analysis working_dir: %(tempdir)s +material: + definitions: %(existing_file)s + active: actmat --- find_orientations: orientation_maps: @@ -326,11 +329,11 @@ def test_file(self): self.cfgs[0].find_orientations.orientation_maps.file is None ) self.assertEqual( - self.cfgs[1].find_orientations.orientation_maps.file, + str(self.cfgs[1].find_orientations.orientation_maps.file), os.path.join(test_data['tempdir'], test_data['nonexistent_file']) ) self.assertEqual( - self.cfgs[2].find_orientations.orientation_maps.file, + str(self.cfgs[2].find_orientations.orientation_maps.file), test_data['existing_file'] ) diff --git a/tests/config/test_root.py b/tests/config/test_root.py index 889a23c60..db829dde1 100644 --- a/tests/config/test_root.py +++ b/tests/config/test_root.py @@ -40,7 +40,7 @@ def get_reference_data(cls): def test_analysis_dir(self): self.assertEqual( - self.cfgs[0].analysis_dir, + str(self.cfgs[0].analysis_dir), os.path.join(os.getcwd(), 'analysis') ) @@ -56,11 +56,15 @@ def test_section_inheritance(self): self.assertEqual(self.cfgs[2].analysis_name, 'analysis_2') def test_working_dir(self): - self.assertEqual(self.cfgs[0].working_dir, os.getcwd()) - self.assertEqual(self.cfgs[1].working_dir, test_data['existing_path']) + self.assertEqual(str(self.cfgs[0].working_dir), os.getcwd()) + self.assertEqual( + str(self.cfgs[1].working_dir), test_data['existing_path'] + ) self.assertRaises(IOError, getattr, self.cfgs[2], 'working_dir') self.cfgs[7].working_dir = test_data['existing_path'] - self.assertEqual(self.cfgs[7].working_dir, test_data['existing_path']) + self.assertEqual( + str(self.cfgs[7].working_dir), test_data['existing_path'] + ) self.assertRaises( IOError, setattr, self.cfgs[7], 'working_dir', test_data['nonexistent_path']