File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -1155,14 +1155,14 @@ def _default_compiledirname() -> str:
11551155 return safe
11561156
11571157
1158- def _filter_base_compiledir (path : Path ) -> Path :
1158+ def _filter_base_compiledir (path : str | Path ) -> Path :
11591159 # Expand '~' in path
1160- return path .expanduser ()
1160+ return Path ( path ) .expanduser ()
11611161
11621162
1163- def _filter_compiledir (path : Path ) -> Path :
1163+ def _filter_compiledir (path : str | Path ) -> Path :
11641164 # Expand '~' in path
1165- path = path .expanduser ()
1165+ path = Path ( path ) .expanduser ()
11661166 # Turn path into the 'real' path. This ensures that:
11671167 # 1. There is no relative path, which would fail e.g. when trying to
11681168 # import modules from the compile dir.
Original file line number Diff line number Diff line change 33import configparser as stdlib_configparser
44import io
55import pickle
6+ from pathlib import Path
7+ from tempfile import mkdtemp
68
79import pytest
810
@@ -19,6 +21,15 @@ def _create_test_config():
1921 )
2022
2123
24+ def test_config_paths ():
25+ base_compiledir = mkdtemp ()
26+ assert configdefaults ._filter_base_compiledir (str (base_compiledir )) == Path (
27+ base_compiledir
28+ )
29+ compiledir = mkdtemp ()
30+ assert configdefaults ._filter_compiledir (str (compiledir )) == Path (compiledir )
31+
32+
2233def test_invalid_default ():
2334 # Ensure an invalid default value found in the PyTensor code only causes
2435 # a crash if it is not overridden by the user.
You can’t perform that action at this time.
0 commit comments