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
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
tails
mat2
Commits
c037e265
Commit
c037e265
authored
6 years ago
by
Julien (jvoisin) Voisin
Browse files
Options
Downloads
Patches
Plain Diff
Add a `--version` option
parent
ef956e84
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
main.py
+3
-0
3 additions, 0 deletions
main.py
tests/test_climat2.py
+10
-2
10 additions, 2 deletions
tests/test_climat2.py
with
13 additions
and
2 deletions
main.py
+
3
−
0
View file @
c037e265
...
...
@@ -10,6 +10,7 @@ import multiprocessing
from
src
import
parser_factory
__version__
=
'
0.1
'
def
__check_file
(
filename
:
str
,
mode
:
int
=
os
.
R_OK
)
->
bool
:
if
not
os
.
path
.
isfile
(
filename
):
...
...
@@ -24,6 +25,8 @@ def __check_file(filename:str, mode:int = os.R_OK) -> bool:
def
create_arg_parser
():
parser
=
argparse
.
ArgumentParser
(
description
=
'
Metadata anonymisation toolkit 2
'
)
parser
.
add_argument
(
'
files
'
,
nargs
=
'
*
'
)
parser
.
add_argument
(
'
-v
'
,
'
--version
'
,
action
=
'
version
'
,
version
=
'
MAT2 %s
'
%
__version__
)
info
=
parser
.
add_argument_group
(
'
Information
'
)
info
.
add_argument
(
'
-c
'
,
'
--check
'
,
action
=
'
store_true
'
,
...
...
This diff is collapsed.
Click to expand it.
tests/test_climat2.py
+
10
−
2
View file @
c037e265
...
...
@@ -8,12 +8,20 @@ class TestHelp(unittest.TestCase):
def
test_help
(
self
):
proc
=
subprocess
.
Popen
([
'
./main.py
'
,
'
--help
'
],
stdout
=
subprocess
.
PIPE
)
stdout
,
_
=
proc
.
communicate
()
self
.
assertIn
(
b
'
usage: main.py [-h] [-c] [-l] [-s] [-L] [files [files ...]]
'
,
stdout
)
self
.
assertIn
(
b
'
usage: main.py [-h]
[-v]
[-c] [-l] [-s] [-L] [files [files ...]]
'
,
stdout
)
def
test_no_arg
(
self
):
proc
=
subprocess
.
Popen
([
'
./main.py
'
],
stdout
=
subprocess
.
PIPE
)
stdout
,
_
=
proc
.
communicate
()
self
.
assertIn
(
b
'
usage: main.py [-h] [-c] [-l] [-s] [-L] [files [files ...]]
'
,
stdout
)
self
.
assertIn
(
b
'
usage: main.py [-h] [-v] [-c] [-l] [-s] [-L] [files [files ...]]
'
,
stdout
)
class
TestVersion
(
unittest
.
TestCase
):
def
test_version
(
self
):
proc
=
subprocess
.
Popen
([
'
./main.py
'
,
'
--version
'
],
stdout
=
subprocess
.
PIPE
)
stdout
,
_
=
proc
.
communicate
()
self
.
assertTrue
(
stdout
.
startswith
(
b
'
MAT2
'
))
class
TestReturnValue
(
unittest
.
TestCase
):
...
...
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