EOX GitLab Instance
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
VS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ESA
PRISM
VS
Commits
02a7b12f
Commit
02a7b12f
authored
3 years ago
by
Mussab Abdalla
Browse files
Options
Downloads
Patches
Plain Diff
test editing
parent
4768c36c
No related branches found
No related tags found
1 merge request
!82
Staging to master
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
testing/ingestor_test.py
+17
-15
17 additions, 15 deletions
testing/ingestor_test.py
with
17 additions
and
15 deletions
testing/ingestor_test.py
+
17
−
15
View file @
02a7b12f
...
...
@@ -75,22 +75,24 @@ def test_preprocessor(list_tifs):
def
test_error_logging
():
with
open
(
'
ingestor_log.txt
'
,
'
r
'
)
as
log_file
:
lines
=
log_file
.
read
().
splitlines
()
error_lines
=
list
(
filter
(
lambda
x
:
'
ERROR:
'
in
x
,
lines
))
xml_error_lines
=
list
(
filter
(
lambda
x
:
'
lxml.etree.XMLSyntaxError
'
in
x
,
lines
))
log_file
.
close
()
for
line
in
lines
:
if
'
ERROR:
'
in
line
:
# check the error notification
assert
'
Failed to parse XML.
'
in
line
match
=
re
.
search
(
'
[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}
'
,
line
)
date
=
datetime
.
datetime
.
strptime
(
match
.
group
(),
"
%Y-%m-%d %H:%M:%S
"
).
date
()
# check the associated error time
assert
type
(
date
)
==
datetime
.
date
if
'
lxml.etree.XMLSyntaxError
'
in
line
:
# Check the specific expected error reprot
error_msg
=
"
Start tag expected,
'
<
'
not found, line 1, column 1
"
assert
error_msg
in
line
for
line
in
error_
line
s
:
# check the error notification
assert
'
Failed to parse XML.
'
in
line
match
=
re
.
search
(
'
[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}
'
,
line
)
date
=
datetime
.
datetime
.
strptime
(
match
.
group
(),
"
%Y-%m-%d %H:%M:%S
"
).
date
()
# check the associated error time
assert
type
(
date
)
==
datetime
.
date
for
line
in
xml_error_
line
s
:
# Check the specific expected error reprot
error_msg
=
"
Start tag expected,
'
<
'
not found, line 1, column 1
"
assert
error_msg
in
line
...
...
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