Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
Base Worker
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
Workers
Base Worker
Commits
b0437822
Commit
b0437822
authored
2 years ago
by
Yoann Schneider
Committed by
Bastien Abadie
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Speedup test by not loading a real client during tests
parent
6734da98
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!238
Speedup test by not loading a real client during tests
Pipeline
#79714
passed
2 years ago
Stage: test
Stage: build
Stage: release
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
worker-{{cookiecutter.slug}}/tests/conftest.py
+7
-1
7 additions, 1 deletion
worker-{{cookiecutter.slug}}/tests/conftest.py
with
7 additions
and
1 deletion
worker-{{cookiecutter.slug}}/tests/conftest.py
+
7
−
1
View file @
b0437822
...
...
@@ -2,10 +2,13 @@
import
os
import
pytest
from
arkindex_worker.worker.base
import
BaseWorker
from
arkindex.mock
import
MockApiClient
@pytest.fixture
(
autouse
=
True
)
def
setup_environment
(
responses
):
def
setup_environment
(
responses
,
monkeypatch
):
"""
Setup needed environment variables
"""
# Allow accessing remote API schemas
...
...
@@ -20,3 +23,6 @@ def setup_environment(responses):
os
.
environ
[
"
ARKINDEX_API_SCHEMA_URL
"
]
=
schema_url
# Setup a fake worker run ID
os
.
environ
[
"
ARKINDEX_WORKER_RUN_ID
"
]
=
"
1234-{{ cookiecutter.slug }}
"
# Setup a mock api client instead of using a real one
monkeypatch
.
setattr
(
BaseWorker
,
"
setup_api_client
"
,
lambda
_
:
MockApiClient
())
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