[CONPY-75] Two tests are failing Created: 2020-06-11  Updated: 2020-06-15  Resolved: 2020-06-15

Status: Closed
Project: MariaDB Connector/Python
Component/s: Tests
Affects Version/s: 1.0.0
Fix Version/s: 1.0.0

Type: Bug Priority: Blocker
Reporter: Andrew Hutchings (Inactive) Assignee: Georg Richter
Resolution: Fixed Votes: 0
Labels: None


 Description   

Running "python3 setup.py test" shows 2 test failures:

======================================================================
ERROR: test_connection_default_file (test.integration.test_connection.TestConnection)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/linuxjedi/Programming/Git/mariadb-connector-python/test/integration/test_connection.py", line 38, in test_connection_default_file
    f.write("port=%i\n" % default_conf["port"])
KeyError: 'port'
 
======================================================================
ERROR: test_conpy67 (test.integration.test_cursor.TestCursor)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/linuxjedi/Programming/Git/mariadb-connector-python/test/integration/test_cursor.py", line 937, in test_conpy67
    cur.execute("SELECT 1 WHERE 1=2")
mariadb.ProgrammingError: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WHERE 1=2' at line 1
 
----------------------------------------------------------------------



 Comments   
Comment by Andrew Hutchings (Inactive) [ 2020-06-11 ]

Probably easier to read from pytest:

linuxjedi@lxj1:~/Programming/Git/mariadb-connector-python$ pytest-3 
==================================== test session starts ====================================
platform linux -- Python 3.8.2, pytest-4.6.9, py-1.8.1, pluggy-0.13.0
rootdir: /home/linuxjedi/Programming/Git/mariadb-connector-python
collected 124 items                                                                         
 
test/integration/test_connection.py ..F..s....                                        [  8%]
test/integration/test_cursor.py .........................F........................... [ 50%]
......                                                                                [ 55%] 
test/integration/test_cursor_mysql.py .                                               [ 56%]
test/integration/test_dbapi20.py ......................                               [ 74%]
test/integration/test_exception.py ...                                                [ 76%]
test/integration/test_module.py .                                                     [ 77%]
test/integration/test_nondbapi.py s......                                             [ 83%]
test/integration/test_pooling.py ............                                         [ 92%]
test/integration/test_xa.py .........                                                 [100%]
 
========================================= FAILURES ==========================================
________________________ TestConnection.test_connection_default_file ________________________
 
self = <test.integration.test_connection.TestConnection testMethod=test_connection_default_file>
 
    def test_connection_default_file(self):
        if os.path.exists("client.cnf"):
            os.remove("client.cnf")
        default_conf = conf()
        f = open("client.cnf", "w+")
        f.write("[client]\n")
        f.write("host=%s\n" % default_conf["host"])
>       f.write("port=%i\n" % default_conf["port"])
E       KeyError: 'port'
 
test/integration/test_connection.py:38: KeyError
__________________________________ TestCursor.test_conpy67 __________________________________
 
self = <test.integration.test_cursor.TestCursor testMethod=test_conpy67>
 
    def test_conpy67(self):
        con= create_connection()
        cur = con.cursor()
        cur.execute("SELECT 1")
        self.assertEqual(cur.rowcount, -1)
        del cur
        cur = con.cursor()
>       cur.execute("SELECT 1 WHERE 1=2")
E       mariadb.ProgrammingError: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WHERE 1=2' at line 1
 
test/integration/test_cursor.py:937: ProgrammingError
===================================== warnings summary ======================================
test/integration/test_nondbapi.py:110
  /home/linuxjedi/Programming/Git/mariadb-connector-python/test/integration/test_nondbapi.py:110: DeprecationWarning: invalid escape sequence \ 
    str = 'This is a \ and a "'
 
-- Docs: https://docs.pytest.org/en/latest/warnings.html
================ 2 failed, 120 passed, 2 skipped, 1 warnings in 2.61 seconds ================

Generated at Thu Feb 08 03:30:03 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.