You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
withself.assertRaisesRegex(ValueError, "Cannot add to read-only store"):
69
68
env.add("file:///dummy.ttl")
70
69
71
-
deftest_init_no_config_no_path_error(self):
72
-
# Clean up potential leftover .ontoenv in cwd just in case
73
-
ifos.path.exists(".ontoenv"):
74
-
ifos.path.isfile(".ontoenv"):
75
-
os.remove(".ontoenv")
76
-
else:
77
-
shutil.rmtree(".ontoenv")
78
-
withself.assertRaisesRegex(ValueError, "OntoEnv directory not found at \"./.ontoenv\". You must provide a valid path or set recreate=True or temporary=True to create a new OntoEnv."):
79
-
OntoEnv() # No args
70
+
deftest_init_no_config_creates_environment(self):
71
+
original_cwd=Path.cwd()
72
+
withtempfile.TemporaryDirectory() astd:
73
+
os.chdir(td)
74
+
try:
75
+
env=OntoEnv() # No args; should auto-create
76
+
self.assertTrue(Path(".ontoenv").is_dir())
77
+
env.close()
78
+
finally:
79
+
os.chdir(original_cwd)
80
80
81
-
deftest_init_path_no_env_error(self):
81
+
deftest_init_path_auto_initializes(self):
82
82
withtempfile.TemporaryDirectory() astd:
83
83
env_path=Path(td) /"no_env_here"
84
84
env_path.mkdir()
85
-
self.assertFalse((env_path/".ontoenv").exists())
86
-
# Be tolerant of macOS /private prefix differences by matching only the tail.
87
-
tail_pattern=rf'OntoEnv directory not found at: "(.*/)?{re.escape(env_path.name)}/\.ontoenv"'
0 commit comments