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:
1155
1155
return safe
1156
1156
1157
1157
1158
- def _filter_base_compiledir (path : Path ) -> Path :
1158
+ def _filter_base_compiledir (path : str | Path ) -> Path :
1159
1159
# Expand '~' in path
1160
- return path .expanduser ()
1160
+ return Path ( path ) .expanduser ()
1161
1161
1162
1162
1163
- def _filter_compiledir (path : Path ) -> Path :
1163
+ def _filter_compiledir (path : str | Path ) -> Path :
1164
1164
# Expand '~' in path
1165
- path = path .expanduser ()
1165
+ path = Path ( path ) .expanduser ()
1166
1166
# Turn path into the 'real' path. This ensures that:
1167
1167
# 1. There is no relative path, which would fail e.g. when trying to
1168
1168
# import modules from the compile dir.
Original file line number Diff line number Diff line change 3
3
import configparser as stdlib_configparser
4
4
import io
5
5
import pickle
6
+ from pathlib import Path
7
+ from tempfile import mkdtemp
6
8
7
9
import pytest
8
10
@@ -19,6 +21,15 @@ def _create_test_config():
19
21
)
20
22
21
23
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
+
22
33
def test_invalid_default ():
23
34
# Ensure an invalid default value found in the PyTensor code only causes
24
35
# a crash if it is not overridden by the user.
You can’t perform that action at this time.
0 commit comments