Skip to content

Commit

Permalink
Clean Db before query when the test need count
Browse files Browse the repository at this point in the history
  • Loading branch information
unkcpz committed Nov 29, 2024
1 parent 62f6a54 commit 305cc54
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/orm/test_querybuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ def test_dict_multiple_projections(self):
assert dictionary['*'].pk == node.pk
assert dictionary['id'] == node.pk

@pytest.mark.usefixtures('aiida_profile_clean')
def test_operators_eq_lt_gt(self):
nodes = [orm.Data() for _ in range(8)]

Expand All @@ -393,6 +394,7 @@ def test_operators_eq_lt_gt(self):
assert orm.QueryBuilder().append(orm.Node, filters={'attributes.fa': {'>': 1.02}}).count() == 4
assert orm.QueryBuilder().append(orm.Node, filters={'attributes.fa': {'>=': 1.02}}).count() == 5

@pytest.mark.usefixtures('aiida_profile_clean')
def test_subclassing(self):
s = orm.StructureData()
s.base.attributes.set('cat', 'miau')
Expand Down Expand Up @@ -513,6 +515,7 @@ def test_append_validation(self):
# So this should work now:
qb.append(orm.StructureData, tag='s').limit(2).dict()

@pytest.mark.usefixtures('aiida_profile_clean')
def test_tuples(self):
"""Test appending ``cls`` tuples."""
orm.Group(label='helloworld').store()
Expand Down Expand Up @@ -695,6 +698,7 @@ def test_query_links(self):
class TestMultipleProjections:
"""Unit tests for the QueryBuilder ORM class."""

@pytest.mark.usefixtures('aiida_profile_clean')
def test_first_multiple_projections(self):
"""Test `first()` returns correct types and numbers for multiple projections."""
orm.Data().store()
Expand Down

0 comments on commit 305cc54

Please sign in to comment.