CanDIG / clinical_ETL_code

A library to convert clinical data in csv format into json documents for CanDIG ingestion
GNU Lesser General Public License v3.0
0 stars 0 forks source link

DIG-1144: Update to Python 3.12 #47

Closed daisieh closed 10 months ago

daisieh commented 10 months ago

While I'm updating packages, these should be updated as well. You can install and test locally by:

cd clinical_ETL_code
pip install build
python -m build
pip install -e .
pytest
mshadbolt commented 10 months ago

Seems to be a problem with the tests for me:

========================================================================= test session starts ==========================================================================
platform darwin -- Python 3.11.5, pytest-7.4.0, pluggy-1.0.0
rootdir: /Users/marionshadbolt/Documents/GitHub/clinical_ETL_code
plugins: anyio-3.5.0
collected 0 items / 1 error                                                                                                                                            

================================================================================ ERRORS ================================================================================
______________________________________________________________ ERROR collecting tests/test_data_ingest.py ______________________________________________________________
ImportError while importing test module '/Users/marionshadbolt/Documents/GitHub/clinical_ETL_code/tests/test_data_ingest.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/opt/homebrew/anaconda3/lib/python3.11/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_data_ingest.py:3: in <module>
    from clinical_etl import CSVConvert
E   ModuleNotFoundError: No module named 'clinical_etl'
======================================================================= short test summary info ========================================================================
ERROR tests/test_data_ingest.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
=========================================================================== 1 error in 0.15s ===========================================================================
(venv) marionshadbolt@Marions-Air clinical_ETL_code % ls
LICENSE                 _local                  mapping_functions.md    pyproject.toml          sample_inputs           tests                   venv
README.md               dist                    moh_template.csv        requirements.txt        src                     update_moh_template.sh
(venv) marionshadbolt@Marions-Air clinical_ETL_code % python --version
Python 3.12.1
mshadbolt commented 10 months ago

actually looking at this error message maybe there is something weird going on with my conda, not sure if it is using 3.11 or 3.12

mshadbolt commented 10 months ago

ok running with the right python version:

(venv) marionshadbolt@Marions-Air clinical_ETL_code % python3.12 -m pytest
========================================================================= test session starts ==========================================================================
platform darwin -- Python 3.12.1, pytest-7.4.3, pluggy-1.3.0
rootdir: /Users/marionshadbolt/Documents/GitHub/clinical_ETL_code
collected 6 items                                                                                                                                                      

tests/test_data_ingest.py ......                                                                                                                                 [100%]

=========================================================================== warnings summary ===========================================================================
venv/lib/python3.12/site-packages/dateutil/tz/tz.py:37
  /Users/marionshadbolt/Documents/GitHub/clinical_ETL_code/venv/lib/python3.12/site-packages/dateutil/tz/tz.py:37: DeprecationWarning: datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.fromtimestamp(timestamp, datetime.UTC).
    EPOCH = datetime.datetime.utcfromtimestamp(0)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
==================================================================== 6 passed, 1 warning in 13.44s =====================================================================

Should we update the datetime.datetime now to avoid having to do it when it gets deprecated