kevinyang372/code-eval

Fix CI/CD pipeline broken after switching to Postgres

kevinyang372 opened this issue · 1 comments

#!/bin/bash -eo pipefail
python -m unittest test.test_example
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.9/unittest/__main__.py", line 18, in <module>
    main(module=None)
  File "/usr/local/lib/python3.9/unittest/main.py", line 100, in __init__
    self.parseArgs(argv)
  File "/usr/local/lib/python3.9/unittest/main.py", line 147, in parseArgs
    self.createTests()
  File "/usr/local/lib/python3.9/unittest/main.py", line 158, in createTests
    self.test = self.testLoader.loadTestsFromNames(self.testNames,
  File "/usr/local/lib/python3.9/unittest/loader.py", line 220, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "/usr/local/lib/python3.9/unittest/loader.py", line 220, in <listcomp>
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "/usr/local/lib/python3.9/unittest/loader.py", line 154, in loadTestsFromName
    module = __import__(module_name)
  File "/home/circleci/project/test/test_example.py", line 8, in <module>
    from web import app, db
  File "/home/circleci/project/web/__init__.py", line 60, in <module>
    db.create_all()
  File "/home/circleci/.local/lib/python3.9/site-packages/flask_sqlalchemy/__init__.py", line 963, in create_all
    self._execute_for_all_tables(app, bind, 'create_all')
  File "/home/circleci/.local/lib/python3.9/site-packages/flask_sqlalchemy/__init__.py", line 955, in _execute_for_all_tables
    op(bind=self.get_engine(app, bind), **extra)
  File "/home/circleci/.local/lib/python3.9/site-packages/flask_sqlalchemy/__init__.py", line 896, in get_engine
    return connector.get_engine()
  File "/home/circleci/.local/lib/python3.9/site-packages/flask_sqlalchemy/__init__.py", line 556, in get_engine
    self._sa.apply_driver_hacks(self._app, info, options)
  File "/home/circleci/.local/lib/python3.9/site-packages/flask_sqlalchemy/__init__.py", line 830, in apply_driver_hacks
    if info.drivername.startswith('mysql'):
AttributeError: 'NoneType' object has no attribute 'drivername'

Exited with code exit status 1
CircleCI received exit code 1

Seems like test code initialize with mysql configuration