Skip to content

scoped pytest fixture are not invoked for sql tests #15

@lmergner

Description

@lmergner

It looks like scoped fixtures are not run for sql tests. This
affects fixtures that should be run per-function, etc. Tests
pass when setup/teardown is done at the "session" level, but
fail when the table creation scope changes to per-function.


============================= test session starts ==============================
platform darwin -- Python 3.8.2, pytest-5.4.2, py-1.8.1, pluggy-0.13.1
pgTap Connection: postgresql://contrivers:blarg@192.168.1.72:5432/pestle
pgTap Schema: None
rootdir: /Users/lmerg/code/pestle, inifile: setup.cfg, testpaths: tests
plugins: cov-2.9.0, pgtap-0.1.0
collected 2 items

tests/test_models.py .                                                   [ 50%]
tests/test_schema.sql F                                                  [100%]

=================================== FAILURES ===================================
____________________________ pgTap test_schema.sql _____________________________
1..12
not ok 1 - Should have 3 tables
# Failed test 1: "Should have 3 tables"
#     Missing tables:
#         post
#         simple
#         "user"
not ok 2 - table simple should have 4 basic colums
# Failed test 2: "table simple should have 4 basic colums"
#     Missing columns:
#         created
#         extras
#         modified
#         oid
not ok 3 - Column simple.extras should be type json
# Failed test 3: "Column simple.extras should be type json"
#    Column simple.extras does not exist
not ok 4 - table post should have a text column
# Failed test 4: "table post should have a text column"
not ok 5 - table post should have a tsvector column
# Failed test 5: "table post should have a tsvector column"
not ok 6 - table post shouldhave a tsvector column with type tsvector
# Failed test 6: "table post shouldhave a tsvector column with type tsvector"
#    Column post.tsvector does not exist
not ok 7 - table post should have an index on the tsvector column
# Failed test 7: "table post should have an index on the tsvector column"
not ok 8 - table post should have a trigger
# Failed test 8: "table post should have a trigger"
not ok 9 - table user should have a password column
# Failed test 9: "table user should have a password column"
not ok 10 - table user should have a password updated column
# Failed test 10: "table user should have a password updated column"
not ok 11 - Column "user".password_updated should be type timestamp with time zone
# Failed test 11: "Column "user".password_updated should be type timestamp with time zone"
#    Column "user".password_updated does not exist
not ok 12 - table user col token should be unique
# Failed test 12: "table user col token should be unique"
#         have: 
#         want: {token}
# Looks like you failed 12 tests of 12

=============================== warnings summary ===============================
/Users/lmerg/.pyenv/versions/pestle/lib/python3.8/site-packages/_pytest/junitxml.py:417
  /Users/lmerg/.pyenv/versions/pestle/lib/python3.8/site-packages/_pytest/junitxml.py:417: PytestDeprecationWarning: The 'junit_family' default value will change to 'xunit2' in pytest 6.0.
  Add 'junit_family=xunit1' to your pytest.ini file to keep the current format in future versions of pytest and silence this warning.
    _issue_warning_captured(deprecated.JUNIT_XML_DEFAULT_FAMILY, config.hook, 2)

-- Docs: https://docs.pytest.org/en/latest/warnings.html
- generated xml file: /var/folders/tj/sz8275nx2kj4czqq2qsqlwf40000gn/T/tmp-51492xvtYl7kjoN59.xml -

---------- coverage: platform darwin, python 3.8.2-final-0 -----------
Name                 Stmts   Miss  Cover
----------------------------------------
pestle/__init__.py       4      0   100%
pestle/__main__.py      22     22     0%
pestle/models.py        55     14    75%
pestle/schemas.py       47     47     0%
pestle/session.py       41     41     0%
----------------------------------------
TOTAL                  169    124    27%
Coverage HTML written to dir htmlcov

=========================== short test summary info ============================
FAILED tests/test_schema.sql
==================== 1 failed, 1 passed, 1 warning in 2.10s ====================

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions