Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
ICV-mmengine_basecode
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Florian Schiffel
ICV-mmengine_basecode
Commits
b8e7c8ee
Unverified
Commit
b8e7c8ee
authored
3 years ago
by
Mashiro
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix test_auto_argparse when pytest has multiple arguments (#34)
parent
e908959c
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
mmengine/config/config.py
+5
-1
5 additions, 1 deletion
mmengine/config/config.py
tests/data/config/py_config/test_code_in_config.py
+1
-1
1 addition, 1 deletion
tests/data/config/py_config/test_code_in_config.py
tests/test_config/test_config.py
+4
-2
4 additions, 2 deletions
tests/test_config/test_config.py
with
10 additions
and
4 deletions
mmengine/config/config.py
+
5
−
1
View file @
b8e7c8ee
...
...
@@ -4,7 +4,6 @@ import copy
import
os
import
os.path
as
osp
import
platform
import
re
import
shutil
import
sys
import
tempfile
...
...
@@ -26,6 +25,11 @@ DELETE_KEY = '_delete_'
DEPRECATION_KEY
=
'
_deprecation_
'
RESERVED_KEYS
=
[
'
filename
'
,
'
text
'
,
'
pretty_text
'
]
if
platform
.
system
()
==
'
Windows
'
:
import
regex
as
re
else
:
import
re
# type: ignore
class
ConfigDict
(
Dict
):
"""
A dictionary for config which has the same interface as python
'
s built-
...
...
This diff is collapsed.
Click to expand it.
tests/data/config/py_config/test_code_in_config.py
+
1
−
1
View file @
b8e7c8ee
# Copyright (c) OpenMMLab. All rights reserved.
from
mm
cv
import
Config
# isort:skip
from
mm
engine
import
Config
# isort:skip
cfg
=
Config
.
fromfile
(
'
tests/data/config/py_config/simple_config.py
'
)
item5
=
cfg
.
item1
[
0
]
+
cfg
.
item2
.
a
This diff is collapsed.
Click to expand it.
tests/test_config/test_config.py
+
4
−
2
View file @
b8e7c8ee
...
...
@@ -169,7 +169,9 @@ class TestConfig:
cfg
.
merge_from_dict
(
input_options
,
allow_list_keys
=
True
)
def
test_auto_argparser
(
self
):
tmp
=
sys
.
argv
[
1
]
# Temporarily make sys.argv only has one argument and keep backups
tmp
=
sys
.
argv
[
1
:]
sys
.
argv
=
sys
.
argv
[:
2
]
sys
.
argv
[
1
]
=
osp
.
join
(
self
.
data_path
,
'
config/py_config/test_merge_from_multiple_bases.py
'
)
...
...
@@ -181,7 +183,7 @@ class TestConfig:
assert
not
getattr
(
args
,
key
)
# TODO currently do not support nested keys, bool args will be
# overwritten by int
sys
.
argv
[
1
]
=
tmp
sys
.
argv
.
extend
(
tmp
)
def
test_dump
(
self
,
tmp_path
):
file_path
=
'
config/py_config/test_merge_from_multiple_bases.py
'
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment