Skip to content

Commit

Permalink
Fix integration tests & yapf
Browse files Browse the repository at this point in the history
  • Loading branch information
pnwpedro committed Jun 29, 2023
1 parent d5a5bda commit e629c04
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/yapf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
cache: pip

- name: Install yapf
run: pip install yapf
run: pip install yapf==0.40.1

- name: Check Format
run: |
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ If you want to run fauna, then run integration tests separately:

.. code-block:: bash
$ make docker-fauna
$ make run-fauna
$ source venv/bin/activate
$ make install
$ make integration-test
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
]

extras_require = {
"lint": ["yapf==0.32.0"],
"lint": ["yapf==0.40.1"],
"test": [
"pytest==7.3.0", "pytest-env==0.8.1", "pytest-cov==4.0.0",
"pytest-httpx==0.21.3", "pytest-subtests==0.10.0"
Expand Down
11 changes: 8 additions & 3 deletions tests/integration/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,28 @@ def test_query_smoke_test(subtests, client):

def test_query_with_all_stats(client, a_collection):
res = client.query(fql("${col}.create({})", col=a_collection))
doc_id = res.data.id
res = client.query(
fql("${col}.create({})\n${col}.byId(${id})",
col=a_collection,
id=doc_id))
assert res.stats.compute_ops > 0
assert res.stats.read_ops > 0
assert res.stats.write_ops > 0
assert res.stats.storage_bytes_read > 0
assert res.stats.storage_bytes_write > 0
assert res.stats.query_time_ms > 0
assert res.stats.contention_retries >= 0
assert res.stats.contention_retries == 0


def test_query_with_constraint_failure(client):
with pytest.raises(QueryRuntimeError) as e:
client.query(
fql('Function.create({"name": "double", "body": "x => x * 2"})'))
fql('Function.create({"name": "false", "body": "_ => false"})'))

assert e.value.constraint_failures == [
ConstraintFailure(
message="The identifier `double` is reserved.",
message="The identifier `false` is reserved.",
name=None,
paths=[["name"]],
),
Expand Down

0 comments on commit e629c04

Please sign in to comment.