Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Task autotest
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jiří Kalvoda
Task autotest
Commits
3b85960b
Commit
3b85960b
authored
1 year ago
by
Jiří Kalvoda
Browse files
Options
Downloads
Patches
Plain Diff
...
parent
486af6bf
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
task_autotest/test.py
+9
-2
9 additions, 2 deletions
task_autotest/test.py
task_autotest/web/pages.py
+23
-0
23 additions, 0 deletions
task_autotest/web/pages.py
with
32 additions
and
2 deletions
task_autotest/test.py
+
9
−
2
View file @
3b85960b
import
subprocess
import
subprocess
import
os
,
sys
import
os
,
sys
,
shutil
import
time
import
time
import
task_autotest.config
as
config
import
task_autotest.config
as
config
def
test_task_commit
(
task_path
,
commit
,
workdir
=
"
_test
"
):
def
test_task_commit
(
task_path
,
commit
,
workdir
=
"
_test
"
):
start_time
=
time
.
time
()
wd
=
config
.
REPO_DIR
+
"
/
"
+
workdir
wd
=
config
.
REPO_DIR
+
"
/
"
+
workdir
subprocess
.
run
([
"
git
"
,
"
checkout
"
,
commit
],
cwd
=
wd
,
check
=
True
)
subprocess
.
run
([
"
git
"
,
"
checkout
"
,
commit
],
cwd
=
wd
,
check
=
True
)
outdir
=
config
.
DATA_DIR
+
"
/tests/
"
+
task_path
.
replace
(
'
/
'
,
'
_
'
)
+
'
/
'
+
commit
+
'
/
'
outdir
=
config
.
DATA_DIR
+
"
/tests/
"
+
task_path
.
replace
(
'
/
'
,
'
_
'
)
+
'
/
'
+
commit
+
'
/
'
outdir_part
=
"
/
"
.
join
(
outdir
.
split
(
"
/
"
)[:
-
2
])
if
not
os
.
path
.
isdir
(
outdir_part
):
os
.
mkdir
(
outdir_part
)
if
os
.
path
.
isdir
(
outdir
):
shutil
.
rmtree
(
outdir
)
os
.
mkdir
(
outdir
)
os
.
mkdir
(
outdir
)
with
open
(
outdir
+
"
time
"
,
"
w
"
)
as
f
:
with
open
(
outdir
+
"
time
"
,
"
w
"
)
as
f
:
f
.
write
(
time
.
time
(
))
f
.
write
(
str
(
int
(
start_
time
)
))
This diff is collapsed.
Click to expand it.
task_autotest/web/pages.py
+
23
−
0
View file @
3b85960b
...
@@ -11,6 +11,7 @@ import wtforms
...
@@ -11,6 +11,7 @@ import wtforms
from
wtforms.fields
import
EmailField
from
wtforms.fields
import
EmailField
from
wtforms.widgets
import
NumberInput
from
wtforms.widgets
import
NumberInput
import
pprint
import
pprint
import
sys
,
os
import
task_autotest.config
as
config
import
task_autotest.config
as
config
import
task_autotest.web
import
task_autotest.web
...
@@ -83,4 +84,26 @@ def base_page(content, head=html.bucket(), limited_size=True, sticky_head=True,
...
@@ -83,4 +84,26 @@ def base_page(content, head=html.bucket(), limited_size=True, sticky_head=True,
def
web_index
():
def
web_index
():
b
=
html
.
Builder
()
b
=
html
.
Builder
()
return
base_page
(
b
.
root
).
print_file
()
@app.route
(
"
/show_test/<string:task>/<string:commit>/
"
,
methods
=
[
'
GET
'
,
'
POST
'
])
def
show_test
(
task
,
commit
):
if
not
commit
.
isalnum
():
raise
werkzeug
.
exceptions
.
Forbidden
()
if
not
all
(
i
.
isalnum
()
or
i
in
"
_
"
for
i
in
task
):
raise
werkzeug
.
exceptions
.
Forbidden
()
path
=
config
.
DATA_DIR
+
'
/tests/
'
+
task
+
"
/
"
+
commit
+
"
/
"
if
not
os
.
path
.
isdir
(
path
):
return
werkzeug
.
exceptions
.
NotFound
()
b
=
html
.
Builder
()
b
.
h1
(
f
"
Test úlohy
{
task
}
na
{
commit
[
:
12
]
}
"
)
with
open
(
path
+
"
time
"
)
as
f
:
start_time
=
datetime
.
fromtimestamp
(
int
(
f
.
read
()))
b
.
p
(
f
"
Test běžel v
{
start_time
}
"
)
return
base_page
(
b
.
root
).
print_file
()
return
base_page
(
b
.
root
).
print_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