Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fixhdr
Manage
Activity
Members
Labels
Plan
Issues
3
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Software Public
PASSOFT
fixhdr
Commits
f3c06d00
Commit
f3c06d00
authored
4 years ago
by
Maeva Pourpoint
Browse files
Options
Downloads
Patches
Plain Diff
Add unit tests to ensure code basic functionalities
parent
d52a16a4
No related branches found
Branches containing commit
No related tags found
1 merge request
!6
Unit tests
Pipeline
#900
passed with stage
in 40 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitlab-ci.yml
+1
-0
1 addition, 0 deletions
.gitlab-ci.yml
tests/test_fixhdr.py
+13
-12
13 additions, 12 deletions
tests/test_fixhdr.py
tox.ini
+1
-0
1 addition, 0 deletions
tox.ini
with
15 additions
and
12 deletions
.gitlab-ci.yml
+
1
−
0
View file @
f3c06d00
...
...
@@ -27,6 +27,7 @@ linting:
stage
:
test
script
:
-
flake8 --ignore=F403,F405,F821,F841,W504 fixhdr
-
flake8 tests
python3.6
:
image
:
python:3.6
...
...
This diff is collapsed.
Click to expand it.
tests/test_fixhdr.py
+
13
−
12
View file @
f3c06d00
...
...
@@ -4,21 +4,22 @@
"""
Tests for `fixhdr` package.
"""
import
unittest
import
sys
try
:
import
fixhdr
except
ImportError
:
pass
from
unittest.mock
import
patch
class
TestFixhdr
(
unittest
.
TestCase
):
"""
Tests for `fixhdr` package.
"""
def
setUp
(
self
):
"""
Set up test fixtures, if any.
"""
def
tearDown
(
self
):
"""
Tear down test fixtures, if any.
"""
def
test_import
(
self
):
self
.
assertTrue
(
'
fixhdr
'
in
sys
.
modules
,
"
Fixhdr import failed!
"
)
"""
Test fixhdr import
"""
with
patch
(
"
sys.argv
"
,
[
"
fixhdr
"
,
"
-#
"
]):
with
self
.
assertRaises
(
SystemExit
)
as
cmd
:
try
:
import
fixhdr.fixhdr
as
fx
fx
.
Usage
()
except
ImportError
as
e
:
print
(
e
)
self
.
fail
(
"
fixhdr import failed
"
)
self
.
assertEqual
(
cmd
.
exception
.
code
,
0
,
"
sys.exit(0) never called
"
"
- Failed to exercise fixhdr
"
)
This diff is collapsed.
Click to expand it.
tox.ini
+
1
−
0
View file @
f3c06d00
...
...
@@ -5,6 +5,7 @@ envlist = py36, py37, py38, flake8
basepython
=
python
deps
=
flake8
commands
=
flake8 --ignore=F403,F405,F821,F841,W504 fixhdr
flake8
tests
[testenv]
commands
=
python -m unittest
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