(request)
| 357 | |
| 358 | @pytest.fixture() |
| 359 | def db(request): |
| 360 | db_path = "%s/zeronet.db" % config.data_dir |
| 361 | schema = { |
| 362 | "db_name": "TestDb", |
| 363 | "db_file": "%s/zeronet.db" % config.data_dir, |
| 364 | "maps": { |
| 365 | "data.json": { |
| 366 | "to_table": [ |
| 367 | "test", |
| 368 | {"node": "test", "table": "test_importfilter", "import_cols": ["test_id", "title"]} |
| 369 | ] |
| 370 | } |
| 371 | }, |
| 372 | "tables": { |
| 373 | "test": { |
| 374 | "cols": [ |
| 375 | ["test_id", "INTEGER"], |
| 376 | ["title", "TEXT"], |
| 377 | ["json_id", "INTEGER REFERENCES json (json_id)"] |
| 378 | ], |
| 379 | "indexes": ["CREATE UNIQUE INDEX test_id ON test(test_id)"], |
| 380 | "schema_changed": 1426195822 |
| 381 | }, |
| 382 | "test_importfilter": { |
| 383 | "cols": [ |
| 384 | ["test_id", "INTEGER"], |
| 385 | ["title", "TEXT"], |
| 386 | ["json_id", "INTEGER REFERENCES json (json_id)"] |
| 387 | ], |
| 388 | "indexes": ["CREATE UNIQUE INDEX test_importfilter_id ON test_importfilter(test_id)"], |
| 389 | "schema_changed": 1426195822 |
| 390 | } |
| 391 | } |
| 392 | } |
| 393 | |
| 394 | if os.path.isfile(db_path): |
| 395 | os.unlink(db_path) |
| 396 | db = Db.Db(schema, db_path) |
| 397 | db.checkTables() |
| 398 | |
| 399 | def stop(): |
| 400 | db.close() |
| 401 | os.unlink(db_path) |
| 402 | |
| 403 | request.addfinalizer(stop) |
| 404 | return db |
| 405 | |
| 406 | |
| 407 | @pytest.fixture(params=["btctools", "openssl", "libsecp256k1"]) |
nothing calls this directly
no test coverage detected