Tom Keffer <[email protected]> writes:

> I get that, but the rest of the infrastructure necessary to run the tests
> successfully is missing. For example, MySQL and pytest are both needed. The
> user would also have to set up permissions in MySQL in a specific way.

It is normal in pkgsrc packages to have a TEST_DEPENDS line for pytest
(and for test modules, etc.).  This is parallel to expressing DEPENDS
(e.g. configobj) that are needed.  Surely other packaging systems have
an analog.

As for mysql, it would be nice if it could be arranged for those tests
to be reported as skipped, or enabled only if some env var says so, in
order that tests could be run easily in a greater number of
environments.  Or at least to catch exceptions and fail, so that the
rest can run.  I was surprised when I first saw that, as I see sqlite3
as the standard approach quite strongly.


=> Bootstrap dependency digest>=20211023: found digest-20220214
===> Checking for vulnerabilities in py313-weewx-5.3.1
=> Test dependency py313-test-[0-9]*: found py313-test-9.0.2
===> Testing for py313-weewx-5.3.1
============================= test session starts ==============================
platform netbsd10 -- Python 3.13.12, pytest-9.0.2, pluggy-1.6.0
rootdir: /tmp/work/wip/py-weewx/work/weewx-5.3.1
configfile: pyproject.toml
plugins: cov-7.0.0, anyio-4.12.1
collected 354 items / 2 errors

==================================== ERRORS ====================================
________________ ERROR collecting src/weedb/tests/test_mysql.py ________________
/usr/pkg/lib/python3.13/site-packages/pymysql/connections.py:661: in connect
    sock = socket.create_connection(
/usr/pkg/lib/python3.13/socket.py:864: in create_connection
    raise exceptions[0]
/usr/pkg/lib/python3.13/socket.py:849: in create_connection
    sock.connect(sa)
E   ConnectionRefusedError: [Errno 61] Connection refused

During handling of the above exception, another exception occurred:
/tmp/work/wip/py-weewx/work/weewx-5.3.1/src/weedb/tests/test_mysql.py:54: in 
<module>
    connection = MySQLdb.connect(host='localhost', user='weewx1', 
password='weewx1')
                 
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/pkg/lib/python3.13/site-packages/pymysql/connections.py:365: in __init__
    self.connect()
/usr/pkg/lib/python3.13/site-packages/pymysql/connections.py:723: in connect
    raise exc
E   pymysql.err.OperationalError: (2003, "Can't connect to MySQL server on 
'localhost' ([Errno 61] Connection refused)")

During handling of the above exception, another exception occurred:
/tmp/work/wip/py-weewx/work/weewx-5.3.1/src/weedb/tests/test_mysql.py:58: in 
<module>
    connection.close()
    ^^^^^^^^^^
E   NameError: name 'connection' is not defined
______________ ERROR collecting src/weeutil/tests/test_config.py _______________
import file mismatch:
imported module 'test_config' has this __file__ attribute:
  /tmp/work/wip/py-weewx/work/weewx-5.3.1/src/weecfg/tests/test_config.py
which is not the same as the test file we want to collect:
  /tmp/work/wip/py-weewx/work/weewx-5.3.1/src/weeutil/tests/test_config.py
HINT: remove __pycache__ / .pyc files and/or use a unique basename for your 
test file modules
=========================== short test summary info ============================
ERROR src/weedb/tests/test_mysql.py - NameError: name 'connection' is not def...
ERROR src/weeutil/tests/test_config.py
!!!!!!!!!!!!!!!!!!! Interrupted: 2 errors during collection !!!!!!!!!!!!!!!!!!!!
============================== 2 errors in 1.26s ===============================
*** Error code 2

Stop.
make[1]: stopped in /n0/gdt/pkgsrc-current/pkgsrc/wip/py-weewx
*** Error code 1

Stop.
make: stopped in /usr/pkgsrc/wip/py-weewx

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/weewx-user/rmibjh4n83x.fsf%40s1.lexort.com.

Reply via email to