Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
67e1819d
提交
67e1819d
authored
7月 13, 2024
作者:
Virgile Andreani
提交者:
Ricardo Vieira
7月 15, 2024
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix supplying (base_)compiledir as str
上级
f35ce262
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
15 行增加
和
4 行删除
+15
-4
configdefaults.py
pytensor/configdefaults.py
+4
-4
test_config.py
tests/test_config.py
+11
-0
没有找到文件。
pytensor/configdefaults.py
浏览文件 @
67e1819d
...
@@ -1155,14 +1155,14 @@ def _default_compiledirname() -> str:
...
@@ -1155,14 +1155,14 @@ def _default_compiledirname() -> str:
return
safe
return
safe
def
_filter_base_compiledir
(
path
:
Path
)
->
Path
:
def
_filter_base_compiledir
(
path
:
str
|
Path
)
->
Path
:
# Expand '~' in path
# Expand '~' in path
return
path
.
expanduser
()
return
Path
(
path
)
.
expanduser
()
def
_filter_compiledir
(
path
:
Path
)
->
Path
:
def
_filter_compiledir
(
path
:
str
|
Path
)
->
Path
:
# Expand '~' in path
# Expand '~' in path
path
=
path
.
expanduser
()
path
=
Path
(
path
)
.
expanduser
()
# Turn path into the 'real' path. This ensures that:
# Turn path into the 'real' path. This ensures that:
# 1. There is no relative path, which would fail e.g. when trying to
# 1. There is no relative path, which would fail e.g. when trying to
# import modules from the compile dir.
# import modules from the compile dir.
...
...
tests/test_config.py
浏览文件 @
67e1819d
...
@@ -3,6 +3,8 @@
...
@@ -3,6 +3,8 @@
import
configparser
as
stdlib_configparser
import
configparser
as
stdlib_configparser
import
io
import
io
import
pickle
import
pickle
from
pathlib
import
Path
from
tempfile
import
mkdtemp
import
pytest
import
pytest
...
@@ -19,6 +21,15 @@ def _create_test_config():
...
@@ -19,6 +21,15 @@ def _create_test_config():
)
)
def
test_config_paths
():
base_compiledir
=
mkdtemp
()
assert
configdefaults
.
_filter_base_compiledir
(
str
(
base_compiledir
))
==
Path
(
base_compiledir
)
compiledir
=
mkdtemp
()
assert
configdefaults
.
_filter_compiledir
(
str
(
compiledir
))
==
Path
(
compiledir
)
def
test_invalid_default
():
def
test_invalid_default
():
# Ensure an invalid default value found in the PyTensor code only causes
# Ensure an invalid default value found in the PyTensor code only causes
# a crash if it is not overridden by the user.
# a crash if it is not overridden by the user.
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论