Skip to content
This repository has been archived by the owner on Nov 21, 2023. It is now read-only.

update tempfile objects to accept strings #961

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions detectron/tests/test_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def test_merge_cfg_from_cfg(self):
core_config.merge_cfg_from_cfg(cfg2)

def test_merge_cfg_from_file(self):
with tempfile.NamedTemporaryFile() as f:
with tempfile.NamedTemporaryFile(mode='w') as f:
envu.yaml_dump(cfg, f)
s = cfg.MODEL.TYPE
cfg.MODEL.TYPE = 'dummy'
Expand Down Expand Up @@ -158,7 +158,7 @@ def test_deprecated_key_from_list(self):
def test_deprecated_key_from_file(self):
# You should see logger messages like:
# "Deprecated config key (ignoring): MODEL.DILATION"
with tempfile.NamedTemporaryFile() as f:
with tempfile.NamedTemporaryFile(mode='w') as f:
cfg2 = copy.deepcopy(cfg)
cfg2.MODEL.DILATION = 2
envu.yaml_dump(cfg2, f)
Expand All @@ -182,7 +182,7 @@ def test_renamed_key_from_file(self):
# You should see logger messages like:
# "Key EXAMPLE.RENAMED.KEY was renamed to EXAMPLE.KEY;
# please update your config"
with tempfile.NamedTemporaryFile() as f:
with tempfile.NamedTemporaryFile(mode='w') as f:
cfg2 = copy.deepcopy(cfg)
cfg2.EXAMPLE = AttrDict()
cfg2.EXAMPLE.RENAMED = AttrDict()
Expand Down