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
0a4bbe4b
Commit
0a4bbe4b
authored
4 years ago
by
Eva Bardou
Browse files
Options
Downloads
Patches
Plain Diff
Fix some review related code snippets
parent
5aa47513
No related branches found
No related tags found
1 merge request
!67
Store created elements in a local SQLite database
Pipeline
#78296
passed
4 years ago
Stage: test
Stage: build
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
arkindex_worker/cache.py
+3
-3
3 additions, 3 deletions
arkindex_worker/cache.py
tests/data/cache/tables.sqlite
+0
-0
0 additions, 0 deletions
tests/data/cache/tables.sqlite
tests/test_cache.py
+2
-2
2 additions, 2 deletions
tests/test_cache.py
with
5 additions
and
5 deletions
arkindex_worker/cache.py
+
3
−
3
View file @
0a4bbe4b
...
...
@@ -6,7 +6,7 @@ from arkindex_worker import logger
SQL_ELEMENTS_TABLE_CREATION
=
"""
CREATE TABLE IF NOT EXISTS elements (
id VARCHAR(32) PRIMARY KEY,
parent_id VARCHAR(32)
NOT NULL
,
parent_id VARCHAR(32),
name TEXT NOT NULL,
type TEXT NOT NULL,
polygon TEXT,
...
...
@@ -17,8 +17,8 @@ SQL_ELEMENTS_TABLE_CREATION = """CREATE TABLE IF NOT EXISTS elements (
CachedElement
=
namedtuple
(
"
CachedElement
"
,
[
"
id
"
,
"
parent_id
"
,
"
name
"
,
"
type
"
,
"
polygon
"
,
"
worker_version_id
"
,
"
initial
"
],
defaults
=
[
0
],
[
"
id
"
,
"
name
"
,
"
type
"
,
"
polygon
"
,
"
worker_version_id
"
,
"
parent_id
"
,
"
initial
"
],
defaults
=
[
None
,
0
],
)
...
...
This diff is collapsed.
Click to expand it.
tests/data/cache/tables.sqlite
+
0
−
0
View file @
0a4bbe4b
No preview for this file type
This diff is collapsed.
Click to expand it.
tests/test_cache.py
+
2
−
2
View file @
0a4bbe4b
...
...
@@ -60,7 +60,7 @@ def test_create_tables_existing_table():
with
open
(
db_path
,
"
rb
"
)
as
after_file
:
after
=
after_file
.
read
()
assert
before
==
after
assert
before
==
after
,
"
Cache was modified
"
def
test_create_tables
():
...
...
@@ -113,7 +113,7 @@ def test_insert_existing_lines():
with
open
(
db_path
,
"
rb
"
)
as
after_file
:
after
=
after_file
.
read
()
assert
before
==
after
assert
before
==
after
,
"
Cache was modified
"
def
test_insert
():
...
...
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