Bug #73957 Errors running unittests when building Debian package
Submitted: 17 Sep 2014 21:26 Modified: 18 May 2018 9:42
Reporter: Sandro Tosi Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Connector / Python Severity:S3 (Non-critical)
Version:1.2.3 OS:Any
Assigned to: CPU Architecture:Any

[17 Sep 2014 21:26] Sandro Tosi
Description:
Hello,
when building the Debian package, we run unittests in a chroot, and we got this errors/failures:

==============================================================================
ERROR: bugs.BugOra18694096.test_timedelta
------------------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/buildd/mysql-connector-python-1.2.3/tests/test_bugs.py", line 2536, in setUp
    self.cnx.cmd_query(create)
  File "/tmp/buildd/mysql-connector-python-1.2.3/build/testing/mysql/connector/connection.py", line 683, in cmd_query
    statement))
  File "/tmp/buildd/mysql-connector-python-1.2.3/build/testing/mysql/connector/connection.py", line 601, in _handle_result
    raise errors.get_exception(packet)
ProgrammingError: 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(6))' at line 1

==============================================================================
FAIL: locales.LocalesEngClientErrorTests.test__GENERATED_ON
------------------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/buildd/mysql-connector-python-1.2.3/tests/test_locales.py", line 103, in test__GENERATED_ON
    delta.days))  # pylint disable=E1103
AssertionError: eng/client_error.py is more than 120 days old (167)

==============================================================================
FAIL: errorcode.ErrorCodeTests.test__GENERATED_ON
------------------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/buildd/mysql-connector-python-1.2.3/tests/test_errorcode.py", line 45, in test__GENERATED_ON
    "errorcode.py is more than 120 days old ({0})".format(delta))
AssertionError: errorcode.py is more than 120 days old (167)

==============================================================================
FAIL: tests.py2.test_network.MySQLTCPSocketTests.test_open_connection__ipv4
Open a connection using TCP
------------------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/buildd/mysql-connector-python-1.2.3/tests/py2/test_network.py", line 404, in test_open_connection__ipv4
    self._test_open_connection(*case)
  File "/tmp/buildd/mysql-connector-python-1.2.3/tests/py2/test_network.py", line 441, in _test_open_connection
    addr, family, sock._family))
AssertionError: Family for ::1 did not match

------------------------------------------------------------------------------
Ran 525 tests in 33.497s

FAILED (failures=3, errors=1, skipped=5)

How to repeat:
.
[23 Sep 2014 9:53] Geert Vanderkelen
Hi Sandro,

The first problem is that the MySQL server used does not support fractional timestamps. However, unit testing should catch this and not run tests.

The tests checking the errors you can ignore. The are mostly for us internally.

The ::1 issue is something with IPv6 tests failing.

Can you disclose the full command line with which you run the tests, just so we can verify. What is the current MySQL version with which you are testing now in Debian?
[24 Oct 2014 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[6 Nov 2014 11:17] Sandro Tosi
Hello,
sorry for the delay.

the makefile snippet I use to run the tests is:

```
        -for python in $(PYTHON2) $(PYTHON3); do \
                LIB=$$($$python -c "from distutils.command.build import build ; from distutils.core import Distribution ; b = build(Distribution()) ; b.finalize_options() ; print (b.build_purelib)") ;\
                mkdir -p $(CURDIR)/mysql_myconnpy/ ; \
                PYTHONPATH=$(CURDIR)/$$LIB $$python unittests.py --with-mysql=/usr/ --mysql-topdir=$(CURDIR)/mysql_myconnpy/ --verbosity=2 --bind-address=:: --host=::1 --stats ; \
                rm -rf $(CURDIR)/mysql_myconnpy/ ; \
        done
```

CURDIR is the full path for the current build directory, LIB is where the module has been built by `setup.py build` and the dir created is where to setup the testing mysql instance.

the MySQL server version I'm using is 5.5.39 (as packaged by Debian).
[17 Jun 2016 20:14] Sandro Tosi
the only left error is:

FAIL: network.MySQLTCPSocketTests.test_open_connection__ipv4
Open a connection using TCP
------------------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/mysql-connector-python-2.1.3/tests/test_network.py", line 403, in test_open_connection__ipv4
    self._test_open_connection(*case)
  File "/build/mysql-connector-python-2.1.3/tests/test_network.py", line 440, in _test_open_connection
    addr, family, sock._family))
AssertionError: Family for ::1 did not match

which is a failure at using ipv4
[18 May 2018 9:42] Chiranjeevi Battula
Hello Sandro Tosi,

Thank you for the bug report.
I tried with latest version of MySQL Connector/Python 8.0.11 version as well and it worked without any issues.
Probably this is fixed in latest version, please feel free to reopen this bug report if you encounter this issue again.

Thanks,
Chiranjeevi.