Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
mat2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
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
jvoisin
mat2
Commits
911d822c
Commit
911d822c
authored
5 years ago
by
Julien (jvoisin) Voisin
Browse files
Options
Downloads
Patches
Plain Diff
Add tests to find possible race-conditions in the cli
parent
7e031c97
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!44
Add tests to find possible race-conditions in the cli
Pipeline
#24617
failed
5 years ago
Stage: linting
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_climat2.py
+39
-0
39 additions, 0 deletions
tests/test_climat2.py
with
39 additions
and
0 deletions
tests/test_climat2.py
+
39
−
0
View file @
911d822c
...
...
@@ -2,6 +2,9 @@ import os
import
shutil
import
subprocess
import
unittest
import
glob
from
libmat2
import
images
,
parser_factory
mat2_binary
=
[
'
./mat2
'
]
...
...
@@ -181,3 +184,39 @@ class TestControlCharInjection(unittest.TestCase):
stdout
=
subprocess
.
PIPE
)
stdout
,
_
=
proc
.
communicate
()
self
.
assertIn
(
b
'
Comment: GQ
\n
'
,
stdout
)
class
TestCommandLineParallel
(
unittest
.
TestCase
):
iterations
=
24
def
test_same
(
self
):
for
i
in
range
(
self
.
iterations
):
shutil
.
copy
(
'
./tests/data/dirty.jpg
'
,
'
./tests/data/dirty_%d.jpg
'
%
i
)
proc
=
subprocess
.
Popen
(
mat2_binary
+
[
'
./tests/data/dirty_%d.jpg
'
%
i
for
i
in
range
(
self
.
iterations
)],
stdout
=
subprocess
.
PIPE
)
stdout
,
_
=
proc
.
communicate
()
for
i
in
range
(
self
.
iterations
):
path
=
'
./tests/data/dirty_%d.jpg
'
%
i
p
=
images
.
JPGParser
(
'
./tests/data/dirty_%d.cleaned.jpg
'
%
i
)
self
.
assertEqual
(
p
.
get_meta
(),
{})
os
.
remove
(
'
./tests/data/dirty_%d.cleaned.jpg
'
%
i
)
os
.
remove
(
path
)
def
test_different
(
self
):
shutil
.
copytree
(
'
./tests/data/
'
,
'
./tests/data/parallel
'
)
proc
=
subprocess
.
Popen
(
mat2_binary
+
glob
.
glob
(
'
./tests/data/parallel/dirty.*
'
),
stdout
=
subprocess
.
PIPE
)
stdout
,
_
=
proc
.
communicate
()
for
i
in
glob
.
glob
(
'
./test/data/parallel/dirty.cleaned.*
'
):
p
,
mime
=
parser_factory
.
get_parser
(
i
)
self
.
assertIsNotNone
(
mime
)
self
.
assertIsNotNone
(
p
)
p
=
parser_factory
.
get_parser
(
p
.
output_filename
)
self
.
assertEqual
(
p
.
get_meta
(),
{})
print
(
'
DELET: %s
'
%
i
)
shutil
.
rmtree
(
'
./tests/data/parallel
'
)
This diff is collapsed.
Click to expand it.
jvoisin
@jvoisin
mentioned in merge request
!43 (closed)
·
5 years ago
mentioned in merge request
!43 (closed)
mentioned in merge request !43
Toggle commit list
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