brightway-lca / brightway2-data

Tools for the management of inventory databases and impact assessment methods. Part of the Brightway LCA framework.
https://docs.brightway.dev/
BSD 3-Clause "New" or "Revised" License
8 stars 21 forks source link

Peewee errors in CI on Windows #143

Closed cmutel closed 11 months ago

cmutel commented 11 months ago

See e.g. https://github.com/brightway-lca/brightway2-data/actions/runs/5925857333/job/16066119113

@sami-m-g Can you look into this? Seems to be related to the bw-projects integration.

Here is an example traceback:

self = <peewee.SqliteDatabase object at 0x000001CDA194FD00>

    def _connect(self):
        if sqlite3 is None:
            raise ImproperlyConfigured('SQLite driver not installed!')
>       conn = sqlite3.connect(self.database, timeout=self._timeout,
                               isolation_level=None, **self.connect_params)
E       peewee.OperationalError: unable to open database file

C:\hostedtoolcache\windows\Python\3.9.13\x64\lib\site-packages\peewee.py:3536: OperationalError

During handling of the above exception, another exception occurred:

wrapped = <function activity at 0x000001CDABC20B80>, instance = None, args = ()
kwargs = {}

    @wrapt.decorator
    def bw2test(wrapped, instance, args, kwargs):
        config.dont_warn = True
        config.is_test = True
        config.cache = {}
>       tempdir = projects._use_temp_directory()

bw2data\tests.py:43: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
bw2data\project.py:83: in _use_temp_directory
    projects = BW2DataProjectManager(dir_base_data, dir_base_logs, ":memory:")
bw2data\project.py:45: in __init__
    super().__init__(
C:\hostedtoolcache\windows\Python\3.9.13\x64\lib\site-packages\bw_projects\core.py:56: in __init__
    DatabaseHelper.init_db(self.file_helper.dir_base_data / database_name)
C:\hostedtoolcache\windows\Python\3.9.13\x64\lib\site-packages\bw_projects\helpers.py:17: in init_db
    SQLITE_DATABASE.create_tables([Project])
C:\hostedtoolcache\windows\Python\3.9.13\x64\lib\site-packages\peewee.py:3440: in create_tables
    model.create_table(**options)
C:\hostedtoolcache\windows\Python\3.9.13\x64\lib\site-packages\peewee.py:6924: in create_table
    cls._schema.create_all(safe, **options)
C:\hostedtoolcache\windows\Python\3.9.13\x64\lib\site-packages\peewee.py:6026: in create_all
    self.create_table(safe, **table_options)
C:\hostedtoolcache\windows\Python\3.9.13\x64\lib\site-packages\peewee.py:5877: in create_table
    self.database.execute(self._create_table(safe=safe, **options))
C:\hostedtoolcache\windows\Python\3.9.13\x64\lib\site-packages\peewee.py:3259: in execute
    return self.execute_sql(sql, params)
C:\hostedtoolcache\windows\Python\3.9.13\x64\lib\site-packages\peewee.py:3251: in execute_sql
    cursor.execute(sql, params or ())
C:\hostedtoolcache\windows\Python\3.9.13\x64\lib\site-packages\peewee.py:3019: in __exit__
    reraise(new_type, new_type(exc_value, *exc_args), traceback)
C:\hostedtoolcache\windows\Python\3.9.13\x64\lib\site-packages\peewee.py:192: in reraise
    raise value.with_traceback(tb)
C:\hostedtoolcache\windows\Python\3.9.13\x64\lib\site-packages\peewee.py:3250: in execute_sql
    cursor = self.cursor()
C:\hostedtoolcache\windows\Python\3.9.13\x64\lib\site-packages\peewee.py:3240: in cursor
    self.connect()
C:\hostedtoolcache\windows\Python\3.9.13\x64\lib\site-packages\peewee.py:3195: in connect
    self._initialize_connection(self._state.conn)
C:\hostedtoolcache\windows\Python\3.9.13\x64\lib\site-packages\peewee.py:3019: in __exit__
    reraise(new_type, new_type(exc_value, *exc_args), traceback)
C:\hostedtoolcache\windows\Python\3.9.13\x64\lib\site-packages\peewee.py:192: in reraise
    raise value.with_traceback(tb)
C:\hostedtoolcache\windows\Python\3.9.13\x64\lib\site-packages\peewee.py:3192: in connect
    self._state.set_connection(self._connect())
sami-m-g commented 11 months ago

Fixed by #144 .