Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
my-ci-demo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Daniele Tavagnacco
my-ci-demo
Commits
2a9dc34c
Commit
2a9dc34c
authored
2 weeks ago
by
Daniele Tavagnacco
Browse files
Options
Downloads
Patches
Plain Diff
setup project
parent
7f36f118
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+1
-0
1 addition, 0 deletions
.gitignore
program.py
+25
-0
25 additions, 0 deletions
program.py
test_program.py
+12
-0
12 additions, 0 deletions
test_program.py
with
38 additions
and
0 deletions
.gitignore
0 → 100644
+
1
−
0
View file @
2a9dc34c
test_file.txt
This diff is collapsed.
Click to expand it.
program.py
0 → 100644
+
25
−
0
View file @
2a9dc34c
# program.py
import
os
def
main
():
filename
=
'
test_file.txt
'
try
:
with
open
(
filename
,
'
r
'
)
as
file_in
:
content
=
file_in
.
read
()
messages
=
[
f
'
Found file
{
filename
}
'
,
f
'
That contains
{
content
}
'
]
print
(
'
\n
'
.
join
(
messages
))
except
FileNotFoundError
:
print
(
f
'
Creating file
{
filename
}
'
)
with
open
(
filename
,
'
w
'
)
as
file_out
:
file_out
.
write
(
'
empty
'
)
if
(
value
:
=
os
.
getenv
(
'
GLOBAL_VAR_FOR_CI
'
))
is
not
None
:
return
f
'
Hello,
{
value
}
!
'
else
:
return
(
'
Hello, GitLab CI/CD!
'
)
if
__name__
==
"
__main__
"
:
out
=
main
()
print
(
out
)
This diff is collapsed.
Click to expand it.
test_program.py
0 → 100644
+
12
−
0
View file @
2a9dc34c
# test_program.py
import
unittest
from
program
import
main
class
TestStringMethods
(
unittest
.
TestCase
):
def
test_output
(
self
):
res
=
main
()
self
.
assertEqual
(
'
Hello, GitLab CI/CD!
'
,
res
)
if
__name__
==
'
__main__
'
:
unittest
.
main
()
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