Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lopt
Manage
Activity
Members
Labels
Plan
Issues
1
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
lopt
Commits
d14f8419
Commit
d14f8419
authored
3 years ago
by
Destiny Kuehn
Browse files
Options
Downloads
Patches
Plain Diff
unittest
parent
767819a5
No related branches found
Branches containing commit
No related tags found
3 merge requests
!17
Unittest
,
!16
Unittest
,
!15
Unittest
Pipeline
#1524
failed with stage
in 1 minute and 21 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_two_lopt.py
+27
-0
27 additions, 0 deletions
tests/test_two_lopt.py
with
27 additions
and
0 deletions
tests/test_two_lopt.py
0 → 100644
+
27
−
0
View file @
d14f8419
"""
Tests for
'
lopt
'
package.
"""
import
socket
import
unittest
from
unittest.mock
import
patch
from
lopt.lopt
import
getHostname
,
main
class
Test_lopt
(
unittest
.
TestCase
):
def
test_import
(
self
):
"""
Tests lopt launch
"""
with
patch
(
'
sys.argv
'
,
[
'
lopt
'
,
'
-h
'
]):
with
self
.
assertRaises
(
SystemExit
)
as
cmd
:
main
()
self
.
assertEqual
(
cmd
.
exception
.
code
,
0
,
"
sys.exit(0) never called, failed to exercise lopt
"
)
def
test_get_host_name
(
self
):
"""
Tests that getHostname gets the correct hostname
"""
lopt_name
=
getHostname
()
test_name
=
socket
.
gethostname
()
error_message
=
"
The function getHostname did not retreive the correct hostname.
"
self
.
assertEqual
(
lopt_name
,
test_name
,
error_message
)
if
__name__
==
"
__main__
"
:
unittest
.
main
()
\ No newline at end of file
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