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
Merge requests
!238
Speedup test by not loading a real client during tests
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Speedup test by not loading a real client during tests
test-speedup
into
master
Overview
0
Commits
1
Pipelines
1
Changes
1
Merged
Yoann Schneider
requested to merge
test-speedup
into
master
2 years ago
Overview
0
Commits
1
Pipelines
1
Changes
1
Expand
Closes
#165 (closed)
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
7d96c140
1 commit,
2 years ago
1 file
+
7
−
1
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
worker-{{cookiecutter.slug}}/tests/conftest.py
+
7
−
1
Options
@@ -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
())
Loading