Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to run tests? #673

Closed
mattip opened this issue Dec 29, 2022 · 3 comments
Closed

How to run tests? #673

mattip opened this issue Dec 29, 2022 · 3 comments

Comments

@mattip
Copy link

mattip commented Dec 29, 2022

I am a PyPy developer, and someone suggested we check PyPy + pony to see if our AST is compatible. I tried to run the tests and get an error fixture 'test_case' not found. Any hints what I am doing wrong?

$ git clone https://ponyorg/pony
$ cd pony
$ pypy3 -m pip install pytest
$ pypy3 -m pip install .
$ pypy -m pytest ./pony/orm/tests
full test output
========================================================== test session starts ==========================================================
platform linux -- Python 3.8.16[pypy-7.3.12-alpha], pytest-7.2.0, pluggy-1.0.0
rootdir: /home/mattip/oss/pony
collected 3917 items                                                                                                                    

pony/orm/tests/test_array.py E........................................                                                            [  1%]
pony/orm/tests/test_attribute_options.py .................                                                                        [  1%]
pony/orm/tests/test_autostrip.py ..                                                                                               [  1%]
pony/orm/tests/test_buffer.py ...                                                                                                 [  1%]
pony/orm/tests/test_bug_170.py .                                                                                                  [  1%]
pony/orm/tests/test_bug_182.py .                                                                                                  [  1%]
pony/orm/tests/test_bug_331.py .                                                                                                  [  1%]
pony/orm/tests/test_bug_386.py .                                                                                                  [  1%]
pony/orm/tests/test_cascade.py E......                                                                                            [  1%]
pony/orm/tests/test_cascade_delete.py ..                                                                                          [  1%]
pony/orm/tests/test_collections.py .........                                                                                      [  2%]
pony/orm/tests/test_conversions.py ....                                                                                           [  2%]
pony/orm/tests/test_core_find_in_cache.py ...............                                                                         [  2%]
pony/orm/tests/test_core_multiset.py ............                                                                                 [  2%]
pony/orm/tests/test_crud.py E.....................                                                                                [  3%]
pony/orm/tests/test_crud_raw_sql.py .......                                                                                       [  3%]
pony/orm/tests/test_datetime.py E......................                                                                           [  4%]
pony/orm/tests/test_db_session.py E.................................................                                              [  5%]
pony/orm/tests/test_declarative_attr_set_monad.py E......................................                                         [  6%]
pony/orm/tests/test_declarative_exceptions.py E......................................................                             [  7%]
pony/orm/tests/test_declarative_func_monad.py E...................                                                                [  8%]
pony/orm/tests/test_declarative_join_optimization.py E.....                                                                       [  8%]
pony/orm/tests/test_declarative_object_flat_monad.py ..                                                                           [  8%]
pony/orm/tests/test_declarative_orderby_limit.py E......................                                                          [  9%]
pony/orm/tests/test_declarative_query_set_monad.py E......F......F.........................................................F      [ 11%]
pony/orm/tests/test_declarative_sqltranslator.py E............................................................................... [ 13%]
.................                                                                                                                 [ 13%]
pony/orm/tests/test_declarative_sqltranslator2.py E...................................                                            [ 14%]
pony/orm/tests/test_declarative_strings.py E......................................................                                [ 15%]
pony/orm/tests/test_decompiler.py ............................................................................................... [ 18%]
................................................................................................................................. [ 21%]
................................................................................................................................. [ 24%]
................................................................................................................................. [ 28%]
................................................................................................................................. [ 31%]
................................................................................................................................. [ 34%]
................................................................................................................................. [ 38%]
................................................................................................................................. [ 41%]
................................................................................................................................. [ 44%]
................................................................................................................................. [ 47%]
................................................................................................................................. [ 51%]
................................................................................................................................. [ 54%]
................................................................................................................................. [ 57%]
................................................................................................................................. [ 61%]
................................................................................................................................. [ 64%]
................................................................................................................................. [ 67%]
................................................................................................................................. [ 71%]
................................................................................................................................. [ 74%]
................................................................................................................................. [ 77%]
................................................................................................................................. [ 80%]
..............E                                                                                                                   [ 81%]
pony/orm/tests/test_deduplication.py ...                                                                                          [ 81%]
pony/orm/tests/test_diagram.py E..............                                                                                    [ 81%]
pony/orm/tests/test_diagram_attribute.py E....................................................................                    [ 83%]
pony/orm/tests/test_diagram_keys.py E....................                                                                         [ 84%]
pony/orm/tests/test_distinct.py E.....                                                                                            [ 84%]
pony/orm/tests/test_entity_init.py .                                                                                              [ 84%]
pony/orm/tests/test_entity_proxy.py E.........                                                                                    [ 84%]
pony/orm/tests/test_exists.py E.......                                                                                            [ 84%]
pony/orm/tests/test_f_strings.py E..........                                                                                      [ 84%]
pony/orm/tests/test_filter.py ........                                                                                            [ 85%]
pony/orm/tests/test_flush.py E.                                                                                                   [ 85%]
pony/orm/tests/test_frames.py E..........................                                                                         [ 85%]
pony/orm/tests/test_generator_db_session.py E............                                                                         [ 86%]
pony/orm/tests/test_get_pk.py ...                                                                                                 [ 86%]
pony/orm/tests/test_getattr.py ..........                                                                                         [ 86%]
pony/orm/tests/test_hooks.py ......                                                                                               [ 86%]
pony/orm/tests/test_hybrid_methods_and_properties.py E...................................                                         [ 87%]
pony/orm/tests/test_indexes.py E.....                                                                                             [ 87%]
pony/orm/tests/test_inheritance.py E......................                                                                        [ 88%]
pony/orm/tests/test_inner_join_syntax.py ....                                                                                     [ 88%]
pony/orm/tests/test_int_converter.py E....                                                                                        [ 88%]
pony/orm/tests/test_interleave.py sssss                                                                                           [ 88%]
pony/orm/tests/test_isinstance.py E.........                                                                                      [ 89%]
pony/orm/tests/test_json.py ........................................................................                              [ 90%]
pony/orm/tests/test_lambda.py .....                                                                                               [ 90%]
pony/orm/tests/test_lazy.py .....                                                                                                 [ 91%]
pony/orm/tests/test_list_monad.py E........                                                                                       [ 91%]
pony/orm/tests/test_mapping.py E.....................                                                                             [ 91%]
pony/orm/tests/test_objects_to_save_cleanup.py ......                                                                             [ 92%]
pony/orm/tests/test_prefetching.py E...................                                                                           [ 92%]
pony/orm/tests/test_prop_sum_orderby.py E..............                                                                           [ 92%]
pony/orm/tests/test_query.py E.......................................                                                             [ 93%]
pony/orm/tests/test_random.py E..                                                                                                 [ 94%]
pony/orm/tests/test_raw_sql.py .....................                                                                              [ 94%]
pony/orm/tests/test_relations_m2m.py .................                                                                            [ 95%]
pony/orm/tests/test_relations_one2many.py E...................                                                                    [ 95%]
pony/orm/tests/test_relations_one2one1.py ..............                                                                          [ 95%]
pony/orm/tests/test_relations_one2one2.py E..........                                                                             [ 96%]
pony/orm/tests/test_relations_one2one3.py E.......                                                                                [ 96%]
pony/orm/tests/test_relations_one2one4.py E.                                                                                      [ 96%]
pony/orm/tests/test_relations_symmetric_m2m.py .........                                                                          [ 96%]
pony/orm/tests/test_relations_symmetric_one2one.py ......                                                                         [ 96%]
pony/orm/tests/test_seeds.py E.                                                                                                   [ 96%]
pony/orm/tests/test_select_from_select_queries.py E.............................................                                  [ 98%]
pony/orm/tests/test_show.py E..                                                                                                   [ 98%]
pony/orm/tests/test_sqlbuilding_formatstyles.py .....                                                                             [ 98%]
pony/orm/tests/test_sqlbuilding_sqlast.py FF                                                                                      [ 98%]
pony/orm/tests/test_sqlite_shared_memory_db.py .                                                                                  [ 98%]
pony/orm/tests/test_sqlite_str_functions.py E.......                                                                              [ 98%]
pony/orm/tests/test_time_parsing.py ..............                                                                                [ 98%]
pony/orm/tests/test_to_dict.py E.........................                                                                         [ 99%]
pony/orm/tests/test_tracked_value.py ....                                                                                         [ 99%]
pony/orm/tests/test_transaction_lock.py ...                                                                                       [ 99%]
pony/orm/tests/test_validate.py ....                                                                                              [ 99%]
pony/orm/tests/test_volatile.py E......                                                                                           [100%]

================================================================ ERRORS =================================================================
_________________________________________________ ERROR at setup of test_exception_msg __________________________________________________
file /home/mattip/oss/pony/pony/orm/tests/testutils.py, line 9
  def test_exception_msg(test_case, exc_msg, test_msg=None):
E       fixture 'test_case' not found
>       available fixtures: cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
>       use 'pytest --fixtures [testpath]' for help on them.

/home/mattip/oss/pony/pony/orm/tests/testutils.py:9
_________________________________________________ ERROR at setup of test_exception_msg __________________________________________________
file /home/mattip/oss/pony/pony/orm/tests/testutils.py, line 9
  def test_exception_msg(test_case, exc_msg, test_msg=None):
E       fixture 'test_case' not found
>       available fixtures: cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
>       use 'pytest --fixtures [testpath]' for help on them.
...

=============================================================== FAILURES ================================================================
_____________________________________________________ TestQuerySetMonad.test_avg_5 ______________________________________________________

self = <pony.orm.tests.test_declarative_query_set_monad.TestQuerySetMonad testMethod=test_avg_5>

    def test_avg_5(self):
>       result = set(select(g for g in Group if select(s.scholarship for s in g.students).avg(distinct=True) == 50))

pony/orm/tests/test_declarative_query_set_monad.py:210: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pony/orm/core.py:5560: in select
    return make_query(args, frame_depth=cut_traceback_depth+1)
pony/orm/core.py:5546: in make_query
    tree, external_names, cells = decompile(gen)
pony/orm/decompiling.py:38: in decompile
    decompiler = Decompiler(codeobject)
pony/orm/decompiling.py:156: in __init__
    decompiler.decompile()
pony/orm/decompiling.py:256: in decompile
    throw(DecompileError('Unsupported operation: %s' % opname))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

exc_type = DecompileError('Unsupported operation: CALL_METHOD_KW'), args = (), kwargs = {}

    def throw(exc_type, *args, **kwargs):
        if isinstance(exc_type, Exception):
            assert not args and not kwargs
            exc = exc_type
        else: exc = exc_type(*args, **kwargs)
        exc.__cause__ = None
        try:
            if not (pony.MODE == 'INTERACTIVE' and options.CUT_TRACEBACK):
>               raise exc
E               pony.orm.decompiling.DecompileError: Unsupported operation: CALL_METHOD_KW

pony/utils/utils.py:99: DecompileError
____________________________________________________ TestQuerySetMonad.test_count_3b ____________________________________________________

self = <pony.orm.tests.test_declarative_query_set_monad.TestQuerySetMonad testMethod=test_count_3b>

    def test_count_3b(self):
>       result = set(select(s for s in Student if select(c for c in s.courses).count(distinct=False) > 1))

pony/orm/tests/test_declarative_query_set_monad.py:85: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pony/orm/core.py:5560: in select
    return make_query(args, frame_depth=cut_traceback_depth+1)
pony/orm/core.py:5546: in make_query
    tree, external_names, cells = decompile(gen)
pony/orm/decompiling.py:38: in decompile
    decompiler = Decompiler(codeobject)
pony/orm/decompiling.py:156: in __init__
    decompiler.decompile()
pony/orm/decompiling.py:256: in decompile
    throw(DecompileError('Unsupported operation: %s' % opname))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

exc_type = DecompileError('Unsupported operation: CALL_METHOD_KW'), args = (), kwargs = {}

    def throw(exc_type, *args, **kwargs):
        if isinstance(exc_type, Exception):
            assert not args and not kwargs
            exc = exc_type
        else: exc = exc_type(*args, **kwargs)
        exc.__cause__ = None
        try:
            if not (pony.MODE == 'INTERACTIVE' and options.CUT_TRACEBACK):
>               raise exc
E               pony.orm.decompiling.DecompileError: Unsupported operation: CALL_METHOD_KW

pony/utils/utils.py:99: DecompileError
_____________________________________________________ TestQuerySetMonad.test_sum_9 ______________________________________________________

self = <pony.orm.tests.test_declarative_query_set_monad.TestQuerySetMonad testMethod=test_sum_9>

    def test_sum_9(self):
>       result = set(select(g for g in Group if select(s.scholarship for s in g.students).sum(distinct=True) > 200))

pony/orm/tests/test_declarative_query_set_monad.py:153: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pony/orm/core.py:5560: in select
    return make_query(args, frame_depth=cut_traceback_depth+1)
pony/orm/core.py:5546: in make_query
    tree, external_names, cells = decompile(gen)
pony/orm/decompiling.py:38: in decompile
    decompiler = Decompiler(codeobject)
pony/orm/decompiling.py:156: in __init__
    decompiler.decompile()
pony/orm/decompiling.py:256: in decompile
    throw(DecompileError('Unsupported operation: %s' % opname))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

exc_type = DecompileError('Unsupported operation: CALL_METHOD_KW'), args = (), kwargs = {}

    def throw(exc_type, *args, **kwargs):
        if isinstance(exc_type, Exception):
            assert not args and not kwargs
            exc = exc_type
        else: exc = exc_type(*args, **kwargs)
        exc.__cause__ = None
        try:
            if not (pony.MODE == 'INTERACTIVE' and options.CUT_TRACEBACK):
>               raise exc
E               pony.orm.decompiling.DecompileError: Unsupported operation: CALL_METHOD_KW

pony/utils/utils.py:99: DecompileError
_________________________________________________________ TestSQLAST.test_alias _________________________________________________________

self = <pony.orm.tests.test_sqlbuilding_sqlast.TestSQLAST testMethod=test_alias>

    def tearDown(self):
        with db_session:
            conn = self.db.get_connection()
>           conn.executescript("""drop table T1
            """)

pony/orm/tests/test_sqlbuilding_sqlast.py:27: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/tmp/pypy-c-jit-106660-0eb331686ee6-linux64/lib/pypy3.8/_sqlite3.py:425: in executescript
    return cur.executescript(*args)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <_sqlite3.Cursor object at 0x0000000002fcf558>, sql = b'drop table T1\n            '

    def executescript(self, sql):
        self.__check_cursor()
        self._reset = False
        if isinstance(sql, unicode):
            sql = sql.encode('utf-8')
        elif not isinstance(sql, str):
            raise ValueError("script argument must be unicode.")
        statement_star = _ffi.new('sqlite3_stmt **')
        next_char = _ffi.new('char **')
    
        self.__connection.commit()
        while True:
            c_sql = _ffi.new("char[]", sql)
            rc = _lib.sqlite3_prepare(self.__connection._db, c_sql, -1,
                                      statement_star, next_char)
            if rc != _lib.SQLITE_OK:
                raise self.__connection._get_exception(rc)
    
            rc = _lib.SQLITE_ROW
            while rc == _lib.SQLITE_ROW:
                if not statement_star[0]:
                    rc = _lib.SQLITE_OK
                else:
                    rc = _lib.sqlite3_step(statement_star[0])
    
            if rc != _lib.SQLITE_DONE:
                _lib.sqlite3_finalize(statement_star[0])
                if rc == _lib.SQLITE_OK:
                    break
                else:
>                   raise self.__connection._get_exception(rc)
E                   _sqlite3.OperationalError: database table is locked

/tmp/pypy-c-jit-106660-0eb331686ee6-linux64/lib/pypy3.8/_sqlite3.py:1035: OperationalError
________________________________________________________ TestSQLAST.test_alias2 _________________________________________________________

self = <pony.orm.tests.test_sqlbuilding_sqlast.TestSQLAST testMethod=test_alias2>

    def tearDown(self):
        with db_session:
            conn = self.db.get_connection()
>           conn.executescript("""drop table T1
            """)

pony/orm/tests/test_sqlbuilding_sqlast.py:27: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/tmp/pypy-c-jit-106660-0eb331686ee6-linux64/lib/pypy3.8/_sqlite3.py:425: in executescript
    return cur.executescript(*args)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <_sqlite3.Cursor object at 0x0000000006c669c0>, sql = b'drop table T1\n            '

    def executescript(self, sql):
        self.__check_cursor()
        self._reset = False
        if isinstance(sql, unicode):
            sql = sql.encode('utf-8')
        elif not isinstance(sql, str):
            raise ValueError("script argument must be unicode.")
        statement_star = _ffi.new('sqlite3_stmt **')
        next_char = _ffi.new('char **')
    
        self.__connection.commit()
        while True:
            c_sql = _ffi.new("char[]", sql)
            rc = _lib.sqlite3_prepare(self.__connection._db, c_sql, -1,
                                      statement_star, next_char)
            if rc != _lib.SQLITE_OK:
                raise self.__connection._get_exception(rc)
    
            rc = _lib.SQLITE_ROW
            while rc == _lib.SQLITE_ROW:
                if not statement_star[0]:
                    rc = _lib.SQLITE_OK
                else:
                    rc = _lib.sqlite3_step(statement_star[0])
    
            if rc != _lib.SQLITE_DONE:
                _lib.sqlite3_finalize(statement_star[0])
                if rc == _lib.SQLITE_OK:
                    break
                else:
>                   raise self.__connection._get_exception(rc)
E                   _sqlite3.OperationalError: database table is locked

/tmp/pypy-c-jit-106660-0eb331686ee6-linux64/lib/pypy3.8/_sqlite3.py:1035: OperationalError
=========================================================== warnings summary ============================================================
pony/orm/tests/testutils.py:57
  /home/mattip/oss/pony/pony/orm/tests/testutils.py:57: PytestCollectionWarning: cannot collect test class 'TestConnection' because it has a __init__ constructor (from: pony/orm/tests/test_array.py)
    class TestConnection(object):

pony/orm/tests/testutils.py:69
  /home/mattip/oss/pony/pony/orm/tests/testutils.py:69: PytestCollectionWarning: cannot collect test class 'TestCursor' because it has a __init__ constructor (from: pony/orm/tests/test_array.py)
    class TestCursor(object):

pony/orm/tests/testutils.py:84
  /home/mattip/oss/pony/pony/orm/tests/testutils.py:84: PytestCollectionWarning: cannot collect test class 'TestPool' because it has a __init__ constructor (from: pony/orm/tests/test_array.py)
    class TestPool(object):
...

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
======================================================== short test summary info ========================================================
FAILED pony/orm/tests/test_declarative_query_set_monad.py::TestQuerySetMonad::test_avg_5 - pony.orm.decompiling.DecompileError: Unsupported operation: CALL_METHOD_KW
FAILED pony/orm/tests/test_declarative_query_set_monad.py::TestQuerySetMonad::test_count_3b - pony.orm.decompiling.DecompileError: Unsupported operation: CALL_METHOD_KW
FAILED pony/orm/tests/test_declarative_query_set_monad.py::TestQuerySetMonad::test_sum_9 - pony.orm.decompiling.DecompileError: Unsupported operation: CALL_METHOD_KW
FAILED pony/orm/tests/test_sqlbuilding_sqlast.py::TestSQLAST::test_alias - _sqlite3.OperationalError: database table is locked
FAILED pony/orm/tests/test_sqlbuilding_sqlast.py::TestSQLAST::test_alias2 - _sqlite3.OperationalError: database table is locked
ERROR pony/orm/tests/test_array.py::test_exception_msg
ERROR pony/orm/tests/test_cascade.py::test_exception_msg
ERROR pony/orm/tests/test_crud.py::test_exception_msg
ERROR pony/orm/tests/test_datetime.py::test_exception_msg
ERROR pony/orm/tests/test_db_session.py::test_exception_msg
ERROR pony/orm/tests/test_declarative_attr_set_monad.py::test_exception_msg
ERROR pony/orm/tests/test_declarative_exceptions.py::test_exception_msg
ERROR pony/orm/tests/test_declarative_func_monad.py::test_exception_msg
ERROR pony/orm/tests/test_declarative_join_optimization.py::test_exception_msg
ERROR pony/orm/tests/test_declarative_orderby_limit.py::test_exception_msg
ERROR pony/orm/tests/test_declarative_query_set_monad.py::test_exception_msg
ERROR pony/orm/tests/test_declarative_sqltranslator.py::test_exception_msg
ERROR pony/orm/tests/test_declarative_sqltranslator2.py::test_exception_msg
ERROR pony/orm/tests/test_declarative_strings.py::test_exception_msg
ERROR pony/orm/tests/test_decompiler.py::test_method
ERROR pony/orm/tests/test_diagram.py::test_exception_msg
ERROR pony/orm/tests/test_diagram_attribute.py::test_exception_msg
ERROR pony/orm/tests/test_diagram_keys.py::test_exception_msg
ERROR pony/orm/tests/test_distinct.py::test_exception_msg
ERROR pony/orm/tests/test_entity_proxy.py::test_exception_msg
ERROR pony/orm/tests/test_exists.py::test_exception_msg
ERROR pony/orm/tests/test_f_strings.py::test_exception_msg
ERROR pony/orm/tests/test_flush.py::test_exception_msg
ERROR pony/orm/tests/test_frames.py::test_exception_msg
ERROR pony/orm/tests/test_generator_db_session.py::test_exception_msg
ERROR pony/orm/tests/test_hybrid_methods_and_properties.py::test_exception_msg
ERROR pony/orm/tests/test_indexes.py::test_exception_msg
ERROR pony/orm/tests/test_inheritance.py::test_exception_msg
ERROR pony/orm/tests/test_int_converter.py::test_exception_msg
ERROR pony/orm/tests/test_isinstance.py::test_exception_msg
ERROR pony/orm/tests/test_list_monad.py::test_exception_msg
ERROR pony/orm/tests/test_mapping.py::test_exception_msg
ERROR pony/orm/tests/test_prefetching.py::test_exception_msg
ERROR pony/orm/tests/test_prop_sum_orderby.py::test_exception_msg
ERROR pony/orm/tests/test_query.py::test_exception_msg
ERROR pony/orm/tests/test_random.py::test_exception_msg
ERROR pony/orm/tests/test_relations_one2many.py::test_exception_msg
ERROR pony/orm/tests/test_relations_one2one2.py::test_exception_msg
ERROR pony/orm/tests/test_relations_one2one3.py::test_exception_msg
ERROR pony/orm/tests/test_relations_one2one4.py::test_exception_msg
ERROR pony/orm/tests/test_seeds.py::test_exception_msg
ERROR pony/orm/tests/test_select_from_select_queries.py::test_exception_msg
ERROR pony/orm/tests/test_show.py::test_exception_msg
ERROR pony/orm/tests/test_sqlite_str_functions.py::test_exception_msg
ERROR pony/orm/tests/test_to_dict.py::test_exception_msg
ERROR pony/orm/tests/test_volatile.py::test_exception_msg
============================= 5 failed, 3861 passed, 5 skipped, 184 warnings, 46 errors in 81.56s (0:01:21) =============================

short test output:

  • lots of warnings like

    pony/orm/tests/testutils.py:84
      /home/mattip/oss/pony/pony/orm/tests/testutils.py:84:   PytestCollectionWarning: cannot collect test class 'TestPool' because it has a __init__ constructor (from: pony/orm/tests/test_show.py)
        class TestPool(object):
    
  • lots of collection errors like

    _________ ERROR at setup of test_exception_msg __________
    file /home/mattip/oss/pony/pony/orm/tests/testutils.py, line 9
      def test_exception_msg(test_case, exc_msg, test_msg=None):
    E       fixture 'test_case' not found
    >       available fixtures: cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
    >       use 'pytest --fixtures [testpath]' for help on them.
    
  • some errors around teardown of databases that are locked (probably due to close not being called explicitly for PyPy

  • some errors about missing opcode, these are the ones I was looking for. They all look like

    /test_declarative_query_set_monad.py::TestQuerySetMonad::test_avg_5 - pony.orm.decompiling. \
    DecompileError: Unsupported operation: CALL_METHOD_KW
    
@sashaaero
Copy link
Member

sashaaero commented Dec 29, 2022

Hello, first I want to say that Pony tests are unittest not pytest.
And you run them as

cd pony/orm
python -m unittest discover

@mattip
Copy link
Author

mattip commented Dec 29, 2022

ahh, cool. That gives a much more reasonable output

full output
GET NEW CONNECTION
RELEASE CONNECTION
GET CONNECTION FROM THE LOCAL POOL
PRAGMA foreign_keys = false
BEGIN IMMEDIATE TRANSACTION
COMMIT
PRAGMA foreign_keys = true
CLOSE CONNECTION
GET NEW CONNECTION
PRAGMA foreign_keys = false
BEGIN IMMEDIATE TRANSACTION
CREATE TABLE "Numbers" (
  "id" INTEGER PRIMARY KEY AUTOINCREMENT,
  "int8" TINYINT NOT NULL,
  "int16" SMALLINT NOT NULL,
  "int24" MEDIUMINT NOT NULL,
  "int32" INTEGER NOT NULL,
  "int64" BIGINT NOT NULL,
  "uint8" TINYINT UNSIGNED NOT NULL,
  "uint16" SMALLINT UNSIGNED NOT NULL,
  "uint24" MEDIUMINT UNSIGNED NOT NULL,
  "uint32" INTEGER UNSIGNED NOT NULL
)

SELECT "Numbers"."id", "Numbers"."int8", "Numbers"."int16", "Numbers"."int24", "Numbers"."int32", "Numbers"."int64", "Numbers"."uint8", "Numbers"."uint16", "Numbers"."uint24", "Numbers"."uint32"
FROM "Numbers" "Numbers"
WHERE 0 = 1

COMMIT
PRAGMA foreign_keys = true
CLOSE CONNECTION
use default sqlite provider
use default sqlite provider
.......................................................................................................................................................................................................................................................................................................................................................................E......E.........................................................E..........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................s.....................................................................................................................................................................................................................................................................................................................................................................EE................................................................
======================================================================
ERROR: test_avg_5 (tests.test_declarative_query_set_monad.TestQuerySetMonad)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/mattip/oss/pony/pony/orm/tests/test_declarative_query_set_monad.py", line 210, in test_avg_5
    result = set(select(g for g in Group if select(s.scholarship for s in g.students).avg(distinct=True) == 50))
  File "/tmp/pypy-c-jit-106660-0eb331686ee6-linux64/lib/pypy3.8/site-packages/pony/orm/core.py", line 5560, in select
    return make_query(args, frame_depth=cut_traceback_depth+1)
  File "/tmp/pypy-c-jit-106660-0eb331686ee6-linux64/lib/pypy3.8/site-packages/pony/orm/core.py", line 5546, in make_query
    tree, external_names, cells = decompile(gen)
  File "/tmp/pypy-c-jit-106660-0eb331686ee6-linux64/lib/pypy3.8/site-packages/pony/orm/decompiling.py", line 38, in decompile
    decompiler = Decompiler(codeobject)
  File "/tmp/pypy-c-jit-106660-0eb331686ee6-linux64/lib/pypy3.8/site-packages/pony/orm/decompiling.py", line 156, in __init__
    decompiler.decompile()
  File "/tmp/pypy-c-jit-106660-0eb331686ee6-linux64/lib/pypy3.8/site-packages/pony/orm/decompiling.py", line 256, in decompile
    throw(DecompileError('Unsupported operation: %s' % opname))
  File "/tmp/pypy-c-jit-106660-0eb331686ee6-linux64/lib/pypy3.8/site-packages/pony/utils/utils.py", line 99, in throw
    raise exc
pony.orm.decompiling.DecompileError: Unsupported operation: CALL_METHOD_KW

======================================================================
ERROR: test_count_3b (tests.test_declarative_query_set_monad.TestQuerySetMonad)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/mattip/oss/pony/pony/orm/tests/test_declarative_query_set_monad.py", line 85, in test_count_3b
    result = set(select(s for s in Student if select(c for c in s.courses).count(distinct=False) > 1))
  File "/tmp/pypy-c-jit-106660-0eb331686ee6-linux64/lib/pypy3.8/site-packages/pony/orm/core.py", line 5560, in select
    return make_query(args, frame_depth=cut_traceback_depth+1)
  File "/tmp/pypy-c-jit-106660-0eb331686ee6-linux64/lib/pypy3.8/site-packages/pony/orm/core.py", line 5546, in make_query
    tree, external_names, cells = decompile(gen)
  File "/tmp/pypy-c-jit-106660-0eb331686ee6-linux64/lib/pypy3.8/site-packages/pony/orm/decompiling.py", line 38, in decompile
    decompiler = Decompiler(codeobject)
  File "/tmp/pypy-c-jit-106660-0eb331686ee6-linux64/lib/pypy3.8/site-packages/pony/orm/decompiling.py", line 156, in __init__
    decompiler.decompile()
  File "/tmp/pypy-c-jit-106660-0eb331686ee6-linux64/lib/pypy3.8/site-packages/pony/orm/decompiling.py", line 256, in decompile
    throw(DecompileError('Unsupported operation: %s' % opname))
  File "/tmp/pypy-c-jit-106660-0eb331686ee6-linux64/lib/pypy3.8/site-packages/pony/utils/utils.py", line 99, in throw
    raise exc
pony.orm.decompiling.DecompileError: Unsupported operation: CALL_METHOD_KW

======================================================================
ERROR: test_sum_9 (tests.test_declarative_query_set_monad.TestQuerySetMonad)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/mattip/oss/pony/pony/orm/tests/test_declarative_query_set_monad.py", line 153, in test_sum_9
    result = set(select(g for g in Group if select(s.scholarship for s in g.students).sum(distinct=True) > 200))
  File "/tmp/pypy-c-jit-106660-0eb331686ee6-linux64/lib/pypy3.8/site-packages/pony/orm/core.py", line 5560, in select
    return make_query(args, frame_depth=cut_traceback_depth+1)
  File "/tmp/pypy-c-jit-106660-0eb331686ee6-linux64/lib/pypy3.8/site-packages/pony/orm/core.py", line 5546, in make_query
    tree, external_names, cells = decompile(gen)
  File "/tmp/pypy-c-jit-106660-0eb331686ee6-linux64/lib/pypy3.8/site-packages/pony/orm/decompiling.py", line 38, in decompile
    decompiler = Decompiler(codeobject)
  File "/tmp/pypy-c-jit-106660-0eb331686ee6-linux64/lib/pypy3.8/site-packages/pony/orm/decompiling.py", line 156, in __init__
    decompiler.decompile()
  File "/tmp/pypy-c-jit-106660-0eb331686ee6-linux64/lib/pypy3.8/site-packages/pony/orm/decompiling.py", line 256, in decompile
    throw(DecompileError('Unsupported operation: %s' % opname))
  File "/tmp/pypy-c-jit-106660-0eb331686ee6-linux64/lib/pypy3.8/site-packages/pony/utils/utils.py", line 99, in throw
    raise exc
pony.orm.decompiling.DecompileError: Unsupported operation: CALL_METHOD_KW

======================================================================
ERROR: test_alias (tests.test_sqlbuilding_sqlast.TestSQLAST)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/mattip/oss/pony/pony/orm/tests/test_sqlbuilding_sqlast.py", line 27, in tearDown
    conn.executescript("""drop table T1
  File "/tmp/pypy-c-jit-106660-0eb331686ee6-linux64/lib/pypy3.8/_sqlite3.py", line 425, in executescript
    return cur.executescript(*args)
  File "/tmp/pypy-c-jit-106660-0eb331686ee6-linux64/lib/pypy3.8/_sqlite3.py", line 1035, in executescript
    raise self.__connection._get_exception(rc)
_sqlite3.OperationalError: database table is locked

======================================================================
ERROR: test_alias2 (tests.test_sqlbuilding_sqlast.TestSQLAST)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/mattip/oss/pony/pony/orm/tests/test_sqlbuilding_sqlast.py", line 27, in tearDown
    conn.executescript("""drop table T1
  File "/tmp/pypy-c-jit-106660-0eb331686ee6-linux64/lib/pypy3.8/_sqlite3.py", line 425, in executescript
    return cur.executescript(*args)
  File "/tmp/pypy-c-jit-106660-0eb331686ee6-linux64/lib/pypy3.8/_sqlite3.py", line 1035, in executescript
    raise self.__connection._get_exception(rc)
_sqlite3.OperationalError: database table is locked

----------------------------------------------------------------------
Ran 3866 tests in 48.386s

FAILED (errors=5, skipped=1)

3 errors due to

pony.orm.decompiling.DecompileError: Unsupported operation: CALL_METHOD_KW

and two due to

_sqlite3.OperationalError: database table is locked

Overall, the test suite runs in ~50 secs (with the latest PyPy3.8) where CPython3.8 runs the suite successfully in ~18 secs. In general, we see about a 2x slowdown when running test suites with PyPy, since the short snippets do not give the JIT time to warm up and the base interpreter is slower. Here we are more than 3x.

@mattip
Copy link
Author

mattip commented Dec 29, 2022

Closing, thanks for the pointer about unittest.

@mattip mattip closed this as completed Dec 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants