Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
DAN
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Container Registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Automatic Text Recognition
DAN
Commits
afbe821f
Verified
Commit
afbe821f
authored
1 year ago
by
Yoann Schneider
Browse files
Options
Downloads
Patches
Plain Diff
Higher level on retry logs
parent
16079372
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!318
Higher level on retry logs
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dan/datasets/extract/utils.py
+1
-1
1 addition, 1 deletion
dan/datasets/extract/utils.py
tests/test_extract.py
+7
-1
7 additions, 1 deletion
tests/test_extract.py
with
8 additions
and
2 deletions
dan/datasets/extract/utils.py
+
1
−
1
View file @
afbe821f
...
@@ -33,7 +33,7 @@ TRIM_RETURN_REGEX = re.compile(r"[\r\n]+")
...
@@ -33,7 +33,7 @@ TRIM_RETURN_REGEX = re.compile(r"[\r\n]+")
def
_retry_log
(
retry_state
,
*
args
,
**
kwargs
):
def
_retry_log
(
retry_state
,
*
args
,
**
kwargs
):
logger
.
debu
g
(
logger
.
warnin
g
(
f
"
Request to
{
retry_state
.
args
[
0
]
}
failed (
{
repr
(
retry_state
.
outcome
.
exception
())
}
),
"
f
"
Request to
{
retry_state
.
args
[
0
]
}
failed (
{
repr
(
retry_state
.
outcome
.
exception
())
}
),
"
f
"
retrying in
{
retry_state
.
idle_for
}
seconds
"
f
"
retrying in
{
retry_state
.
idle_for
}
seconds
"
)
)
...
...
This diff is collapsed.
Click to expand it.
tests/test_extract.py
+
7
−
1
View file @
afbe821f
...
@@ -741,7 +741,7 @@ def test_download_image_error(iiif_url, caplog, capsys):
...
@@ -741,7 +741,7 @@ def test_download_image_error(iiif_url, caplog, capsys):
assert
captured
.
out
==
"
deadbeef: Image URL must be HTTP(S)
\n
"
assert
captured
.
out
==
"
deadbeef: Image URL must be HTTP(S)
\n
"
def
test_download_image_error_try_max
(
responses
):
def
test_download_image_error_try_max
(
responses
,
caplog
):
# An image's URL
# An image's URL
url
=
(
url
=
(
"
https://blabla.com/iiif/2/image_path.jpg/231,699,2789,3659/full/0/default.jpg
"
"
https://blabla.com/iiif/2/image_path.jpg/231,699,2789,3659/full/0/default.jpg
"
...
@@ -774,6 +774,12 @@ def test_download_image_error_try_max(responses):
...
@@ -774,6 +774,12 @@ def test_download_image_error_try_max(responses):
fixed_url
fixed_url
]
]
# Check error log
assert
len
(
caplog
.
record_tuples
)
==
2
# We should only have WARNING levels
assert
set
(
level
for
_
,
level
,
_
in
caplog
.
record_tuples
)
==
{
logging
.
WARNING
}
@pytest.mark.parametrize
(
"
allow_empty
"
,
(
True
,
False
))
@pytest.mark.parametrize
(
"
allow_empty
"
,
(
True
,
False
))
def
test_empty_transcription
(
allow_empty
,
mock_database
):
def
test_empty_transcription
(
allow_empty
,
mock_database
):
...
...
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