Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
Vigenere-API
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
DAVID Axel
Vigenere-API
Commits
727d197a
Commit
727d197a
authored
2 years ago
by
DAVID Axel
Browse files
Options
Downloads
Patches
Plain Diff
test:
Fix integration tests
parent
054c17e6
No related branches found
No related tags found
No related merge requests found
Pipeline
#15238
passed
2 years ago
Stage: .pre
Stage: 🦄 quality 🦄
Stage: 🔒️ security 🔒️
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/integration/api/test_index.py
+1
-1
1 addition, 1 deletion
tests/integration/api/test_index.py
tests/integration/api/v1/conftest.py
+0
-55
0 additions, 55 deletions
tests/integration/api/v1/conftest.py
with
1 addition
and
56 deletions
tests/integration/api/test_index.py
+
1
−
1
View file @
727d197a
...
@@ -46,7 +46,7 @@ def test_bad_path(server: str) -> None:
...
@@ -46,7 +46,7 @@ def test_bad_path(server: str) -> None:
assert
response
is
not
None
assert
response
is
not
None
assert
response
.
status
==
200
assert
response
.
status
_code
==
200
assert
response
.
content
is
not
None
assert
response
.
content
is
not
None
assert
response
.
reason
.
upper
()
==
"
OK
"
assert
response
.
reason
.
upper
()
==
"
OK
"
...
...
This diff is collapsed.
Click to expand it.
tests/integration/api/v1/conftest.py
deleted
100644 → 0
+
0
−
55
View file @
054c17e6
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Vigenere-API +
# Copyright (C) 2023 Axel DAVID +
# +
# This program is free software: you can redistribute it and/or modify it under +
# the terms of the GNU General Public License as published by the Free Software +
# Foundation, either version 3 of the License, or (at your option) any later version. +
# +
# This program is distributed in the hope that it will be useful, but WITHOUT ANY +
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +
# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +
# +
# You should have received a copy of the GNU General Public License along with +
# this program. If not, see <https://www.gnu.org/licenses/>. +
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
import
os
from
collections.abc
import
Generator
from
multiprocessing
import
Process
from
time
import
sleep
import
pytest
import
uvicorn
from
vigenere_api.api
import
application
def
get_sleep_time
()
->
float
:
# when starting a server process,
# a longer sleep time is necessary on Windows
if
os
.
name
==
"
nt
"
:
return
1.5
return
0.5
server_host
=
"
127.0.0.1
"
server_port
=
44555
def
_start_server
()
->
None
:
uvicorn
.
run
(
application
,
host
=
server_host
,
port
=
server_port
,
log_level
=
"
debug
"
)
@pytest.fixture
(
scope
=
"
session
"
,
autouse
=
True
)
def
server
()
->
Generator
[
str
,
None
,
None
]:
server_process
=
Process
(
target
=
_start_server
)
server_process
.
start
()
sleep
(
get_sleep_time
())
if
not
server_process
.
is_alive
():
raise
TypeError
(
"
The server process did not start!
"
)
yield
"
http://
"
+
server_host
+
"
:
"
+
str
(
server_port
)
sleep
(
1.2
)
server_process
.
terminate
()
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