Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
swh-core
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
Model registry
Operate
Environments
Monitor
Incidents
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
Platform
Development
swh-core
Commits
073c6bec
Commit
073c6bec
authored
6 years ago
by
David Douard
Browse files
Options
Downloads
Patches
Plain Diff
tests: assertEquals -> assert Equal
silent deprecation warnings.
parent
83dc362b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!18
activate coverage by default in tox and kill deprecation warnings in tests
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
swh/core/tests/test_config.py
+8
-8
8 additions, 8 deletions
swh/core/tests/test_config.py
swh/core/tests/test_logger.py
+1
-1
1 addition, 1 deletion
swh/core/tests/test_logger.py
swh/core/tests/test_utils.py
+10
-10
10 additions, 10 deletions
swh/core/tests/test_utils.py
with
19 additions
and
19 deletions
swh/core/tests/test_config.py
+
8
−
8
View file @
073c6bec
...
...
@@ -103,28 +103,28 @@ li = 1, 2, 3, 4
res
=
config
.
read
(
self
.
conffile
,
self
.
default_conf
)
# then
self
.
assertEqual
s
(
res
,
self
.
parsed_conffile
)
self
.
assertEqual
(
res
,
self
.
parsed_conffile
)
def
test_read_empty_file
(
self
):
# when
res
=
config
.
read
(
None
,
self
.
default_conf
)
# then
self
.
assertEqual
s
(
res
,
self
.
parsed_default_conf
)
self
.
assertEqual
(
res
,
self
.
parsed_default_conf
)
def
test_support_non_existing_conffile
(
self
):
# when
res
=
config
.
read
(
self
.
non_existing_conffile
,
self
.
default_conf
)
# then
self
.
assertEqual
s
(
res
,
self
.
parsed_default_conf
)
self
.
assertEqual
(
res
,
self
.
parsed_default_conf
)
def
test_support_empty_conffile
(
self
):
# when
res
=
config
.
read
(
self
.
empty_conffile
,
self
.
default_conf
)
# then
self
.
assertEqual
s
(
res
,
self
.
parsed_default_conf
)
self
.
assertEqual
(
res
,
self
.
parsed_default_conf
)
def
test_raise_on_broken_directory_perms
(
self
):
with
self
.
assertRaises
(
PermissionError
):
...
...
@@ -140,7 +140,7 @@ li = 1, 2, 3, 4
self
.
other_default_conf
)
# then
self
.
assertEqual
s
(
res
,
self
.
full_default_conf
)
self
.
assertEqual
(
res
,
self
.
full_default_conf
)
def
test_priority_read_nonexist_conf
(
self
):
# when
...
...
@@ -148,7 +148,7 @@ li = 1, 2, 3, 4
self
.
default_conf
)
# then
self
.
assertEqual
s
(
res
,
self
.
parsed_conffile
)
self
.
assertEqual
(
res
,
self
.
parsed_conffile
)
def
test_priority_read_conf_nonexist_empty
(
self
):
# when
...
...
@@ -159,7 +159,7 @@ li = 1, 2, 3, 4
],
self
.
default_conf
)
# then
self
.
assertEqual
s
(
res
,
self
.
parsed_conffile
)
self
.
assertEqual
(
res
,
self
.
parsed_conffile
)
def
test_priority_read_empty_conf_nonexist
(
self
):
# when
...
...
@@ -170,7 +170,7 @@ li = 1, 2, 3, 4
],
self
.
default_conf
)
# then
self
.
assertEqual
s
(
res
,
self
.
parsed_default_conf
)
self
.
assertEqual
(
res
,
self
.
parsed_default_conf
)
def
test_swh_config_paths
(
self
):
res
=
config
.
swh_config_paths
(
'
foo/bar.ini
'
)
...
...
This diff is collapsed.
Click to expand it.
swh/core/tests/test_logger.py
+
1
−
1
View file @
073c6bec
...
...
@@ -33,7 +33,7 @@ class PgLogHandler(SingleDbTestFixture, unittest.TestCase):
def
test_log
(
self
):
self
.
logger
.
info
(
'
notice
'
,
extra
=
{
'
swh_type
'
:
'
test entry
'
,
'
swh_data
'
:
42
})
self
.
logger
.
warn
(
'
warning
'
)
self
.
logger
.
warn
ing
(
'
warning
'
)
with
self
.
conn
.
cursor
()
as
cur
:
cur
.
execute
(
'
SELECT level, message, data, src_module FROM log
'
)
...
...
This diff is collapsed.
Click to expand it.
swh/core/tests/test_utils.py
+
10
−
10
View file @
073c6bec
...
...
@@ -34,19 +34,19 @@ class UtilsLib(unittest.TestCase):
with
self
.
assertRaises
(
UnicodeDecodeError
):
raw_data_err
.
decode
(
'
utf-8
'
,
'
strict
'
)
self
.
assertEqual
s
(
self
.
assertEqual
(
raw_data_err
.
decode
(
'
utf-8
'
,
'
backslashescape
'
),
'
abcd
\\
x80
'
,
)
raw_data_ok
=
b
'
abcd
\xc3\xa9
'
self
.
assertEqual
s
(
self
.
assertEqual
(
raw_data_ok
.
decode
(
'
utf-8
'
,
'
backslashescape
'
),
raw_data_ok
.
decode
(
'
utf-8
'
,
'
strict
'
),
)
unicode_data
=
'
abcdef
\u00a3
'
self
.
assertEqual
s
(
self
.
assertEqual
(
unicode_data
.
encode
(
'
ascii
'
,
'
backslashescape
'
),
b
'
abcdef
\\
xa3
'
,
)
...
...
@@ -55,7 +55,7 @@ class UtilsLib(unittest.TestCase):
valid_data
=
'
\\
x01020304
\\
x00
'
valid_data_encoded
=
b
'
\x01
020304
\x00
'
self
.
assertEqual
s
(
self
.
assertEqual
(
valid_data_encoded
,
utils
.
encode_with_unescape
(
valid_data
)
)
...
...
@@ -73,7 +73,7 @@ class UtilsLib(unittest.TestCase):
backslashes
=
b
'
foo
\\
bar
\\\\
baz
'
backslashes_escaped
=
'
foo
\\\\
bar
\\\\\\\\
baz
'
self
.
assertEqual
s
(
self
.
assertEqual
(
backslashes_escaped
,
utils
.
decode_with_escape
(
backslashes
),
)
...
...
@@ -81,7 +81,7 @@ class UtilsLib(unittest.TestCase):
valid_utf8
=
b
'
foo
\xc3\xa2
'
valid_utf8_escaped
=
'
foo
\u00e2
'
self
.
assertEqual
s
(
self
.
assertEqual
(
valid_utf8_escaped
,
utils
.
decode_with_escape
(
valid_utf8
),
)
...
...
@@ -89,7 +89,7 @@ class UtilsLib(unittest.TestCase):
invalid_utf8
=
b
'
foo
\xa2
'
invalid_utf8_escaped
=
'
foo
\\
xa2
'
self
.
assertEqual
s
(
self
.
assertEqual
(
invalid_utf8_escaped
,
utils
.
decode_with_escape
(
invalid_utf8
),
)
...
...
@@ -97,7 +97,7 @@ class UtilsLib(unittest.TestCase):
valid_utf8_nul
=
b
'
foo
\xc3\xa2\x00
'
valid_utf8_nul_escaped
=
'
foo
\u00e2\\
x00
'
self
.
assertEqual
s
(
self
.
assertEqual
(
valid_utf8_nul_escaped
,
utils
.
decode_with_escape
(
valid_utf8_nul
),
)
...
...
@@ -107,10 +107,10 @@ class UtilsLib(unittest.TestCase):
actual_commonname
=
utils
.
commonname
(
'
/some/where/to/
'
,
'
/some/where/to/go/to
'
)
# then
self
.
assertEqual
s
(
'
go/to
'
,
actual_commonname
)
self
.
assertEqual
(
'
go/to
'
,
actual_commonname
)
# when
actual_commonname2
=
utils
.
commonname
(
b
'
/some/where/to/
'
,
b
'
/some/where/to/go/to
'
)
# then
self
.
assertEqual
s
(
b
'
go/to
'
,
actual_commonname2
)
self
.
assertEqual
(
b
'
go/to
'
,
actual_commonname2
)
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