mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-25 18:34:32 +02:00
Compare commits
4 commits
main
...
windows-ci
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
deb01a8913 |
||
|
|
44d3c8befc |
||
|
|
7ac1774974 |
||
|
|
f748f103fe |
3 changed files with 10 additions and 7 deletions
3
.github/workflows/test.yml
vendored
3
.github/workflows/test.yml
vendored
|
|
@ -4,11 +4,12 @@ on: [push]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
python-version: [3.6, 3.7, 3.8, 3.9]
|
python-version: [3.6, 3.7, 3.8, 3.9]
|
||||||
numpy: [0, 1]
|
numpy: [0, 1]
|
||||||
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Set up Python ${{ matrix.python-version }}
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ def test_tables_counts_and_columns_csv(db_path, format, expected):
|
||||||
result = CliRunner().invoke(
|
result = CliRunner().invoke(
|
||||||
cli.cli, ["tables", "--counts", "--columns", format, db_path]
|
cli.cli, ["tables", "--counts", "--columns", format, db_path]
|
||||||
)
|
)
|
||||||
assert result.output.strip() == expected
|
assert result.output.strip().replace("\r", "") == expected
|
||||||
|
|
||||||
|
|
||||||
def test_tables_schema(db_path):
|
def test_tables_schema(db_path):
|
||||||
|
|
@ -870,12 +870,13 @@ def test_query_csv(db_path, format, expected):
|
||||||
cli.cli, [db_path, "select id, name, age from dogs", format]
|
cli.cli, [db_path, "select id, name, age from dogs", format]
|
||||||
)
|
)
|
||||||
assert 0 == result.exit_code
|
assert 0 == result.exit_code
|
||||||
assert result.output == expected
|
assert result.output.replace("\r", "") == expected
|
||||||
# Test the no-headers option:
|
# Test the no-headers option:
|
||||||
result = CliRunner().invoke(
|
result = CliRunner().invoke(
|
||||||
cli.cli, [db_path, "select id, name, age from dogs", "--no-headers", format]
|
cli.cli, [db_path, "select id, name, age from dogs", "--no-headers", format]
|
||||||
)
|
)
|
||||||
assert result.output.strip() == "\n".join(expected.split("\n")[1:]).strip()
|
expected_rest = "\n".join(expected.split("\n")[1:]).strip()
|
||||||
|
assert result.output.strip().replace("\r", "") == expected_rest
|
||||||
|
|
||||||
|
|
||||||
_all_query = "select id, name, age from dogs"
|
_all_query = "select id, name, age from dogs"
|
||||||
|
|
@ -1760,7 +1761,7 @@ def test_search(tmpdir, fts, extra_arg, expected):
|
||||||
catch_exceptions=False,
|
catch_exceptions=False,
|
||||||
)
|
)
|
||||||
assert result.exit_code == 0
|
assert result.exit_code == 0
|
||||||
assert result.output == expected
|
assert result.output.replace("\r", "") == expected
|
||||||
|
|
||||||
|
|
||||||
_TRIGGERS_EXPECTED = '[{"name": "blah", "table": "articles", "sql": "CREATE TRIGGER blah AFTER INSERT ON articles\\nBEGIN\\n UPDATE counter SET count = count + 1;\\nEND"}]\n'
|
_TRIGGERS_EXPECTED = '[{"name": "blah", "table": "articles", "sql": "CREATE TRIGGER blah AFTER INSERT ON articles\\nBEGIN\\n UPDATE counter SET count = count + 1;\\nEND"}]\n'
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
from sqlite_utils import cli, Database
|
from sqlite_utils import cli, Database
|
||||||
from click.testing import CliRunner
|
from click.testing import CliRunner
|
||||||
|
import os
|
||||||
import pathlib
|
import pathlib
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -42,7 +43,7 @@ def test_insert_files():
|
||||||
one, two, three = (
|
one, two, three = (
|
||||||
rows_by_path["one.txt"],
|
rows_by_path["one.txt"],
|
||||||
rows_by_path["two.txt"],
|
rows_by_path["two.txt"],
|
||||||
rows_by_path["nested/three.txt"],
|
rows_by_path[os.path.join("nested", "three.txt")],
|
||||||
)
|
)
|
||||||
assert {
|
assert {
|
||||||
"content": b"This is file one",
|
"content": b"This is file one",
|
||||||
|
|
@ -64,7 +65,7 @@ def test_insert_files():
|
||||||
"content": b"Three is nested",
|
"content": b"Three is nested",
|
||||||
"md5": "12580f341781f5a5b589164d3cd39523",
|
"md5": "12580f341781f5a5b589164d3cd39523",
|
||||||
"name": "three.txt",
|
"name": "three.txt",
|
||||||
"path": "nested/three.txt",
|
"path": os.path.join("nested", "three.txt"),
|
||||||
"sha256": "6dd45aaaaa6b9f96af19363a92c8fca5d34791d3c35c44eb19468a6a862cc8cd",
|
"sha256": "6dd45aaaaa6b9f96af19363a92c8fca5d34791d3c35c44eb19468a6a862cc8cd",
|
||||||
"size": 15,
|
"size": 15,
|
||||||
}.items() <= three.items()
|
}.items() <= three.items()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue