arrow-py / arrow

🏹 Better dates & times for Python
https://arrow.readthedocs.io
Apache License 2.0
8.71k stars 673 forks source link

Failed test_one_arg_dateparser_datetime - SystemError (on win32 py36) #967

Closed skupr-anaconda closed 3 years ago

skupr-anaconda commented 3 years ago

Issue Description

test_one_arg_dateparser_datetime failed only in the test environment (not build environment) on win32 with py36 when arrow 1.1.0 was built with conda build. Maybe the problem with dateparse v1.0.0:

Packaging arrow
INFO:conda_build.build:Packaging arrow-1.1.0-py36h9f7ea03_0
Packaging arrow-1.1.0-py36h9f7ea03_0
INFO conda_build.build:bundle_conda(1514): Packaging arrow-1.1.0-py36h9f7ea03_0
compiling .pyc files...
number of files: 29
Fixing permissions
Packaged license file/s.
INFO :: Time taken to mark (prefix)
        0 replacements in 0 files was 0.03 seconds
TEST START: output-artifacts\win-32\arrow-1.1.0-py36h9f7ea03_0.tar.bz2
Renaming work directory 'C:\ci\arrow_1619685159839\work' to 'C:\ci\arrow_1619685159839\work_moved_arrow-1.1.0-py36h9f7ea03_0_win-32'
INFO:conda_build.utils:Renaming work directory 'C:\ci\arrow_1619685159839\work' to 'C:\ci\arrow_1619685159839\work_moved_arrow-1.1.0-py36h9f7ea03_0_win-32'
shutil.move(work)=C:\ci\arrow_1619685159839\work, dest=C:\ci\arrow_1619685159839\work_moved_arrow-1.1.0-py36h9f7ea03_0_win-32)
INFO conda_build.utils:shutil_move_more_retrying(2077): Renaming work directory 'C:\ci\arrow_1619685159839\work' to 'C:\ci\arrow_1619685159839\work_moved_arrow-1.1.0-py36h9f7ea03_0_win-32'
INFO:conda_build.utils:shutil.move(work)=C:\ci\arrow_1619685159839\work, dest=C:\ci\arrow_1619685159839\work_moved_arrow-1.1.0-py36h9f7ea03_0_win-32)
INFO conda_build.utils:shutil_move_more_retrying(2084): shutil.move(work)=C:\ci\arrow_1619685159839\work, dest=C:\ci\arrow_1619685159839\work_moved_arrow-1.1.0-py36h9f7ea03_0_win-32)
Collecting package metadata (repodata.json): ...working... done
Solving environment: ...working... done

## Package Plan ##

  environment location: C:\ci\arrow_1619685159839\_test_env

The following NEW packages will be INSTALLED:

    arrow:              1.1.0-py36h9f7ea03_0     file:///C:/ci/containers/00003du68vt/tmp/build/80754af9/output-artifacts
    atomicwrites:       1.4.0-py_0                                                                                       
    attrs:              20.3.0-pyhd3eb1b0_0                                                                              
    certifi:            2020.12.5-py36h9f7ea03_0                                                                         
    colorama:           0.4.4-pyhd3eb1b0_0                                                                               
    coverage:           5.5-py36hc431981_2                                                                               
    dateparser:         1.0.0-pyhd3eb1b0_0                                                                               
    importlib-metadata: 3.10.0-py36h9f7ea03_0                                                                            
    importlib_metadata: 3.10.0-hd3eb1b0_0                                                                                
    iniconfig:          1.1.1-pyhd3eb1b0_0                                                                               
    more-itertools:     8.7.0-pyhd3eb1b0_0                                                                               
    packaging:          20.9-pyhd3eb1b0_0                                                                                
    pip:                21.0.1-py36h9f7ea03_0                                                                            
    pluggy:             0.13.1-py36h9f7ea03_0                                                                            
    py:                 1.10.0-pyhd3eb1b0_0                                                                              
    pyparsing:          2.4.7-pyhd3eb1b0_0                                                                               
    pytest:             6.2.3-py36h9f7ea03_2                                                                             
    pytest-cov:         2.11.1-pyhd3eb1b0_0                                                                              
    pytest-mock:        3.6.0-pyhd3eb1b0_1                                                                               
    python:             3.6.13-hae2a899_0                                                                                
    python-dateutil:    2.8.1-pyhd3eb1b0_0                                                                               
    pytz:               2021.1-pyhd3eb1b0_0                                                                              
    regex:              2021.4.4-py36hc431981_0                                                                          
    setuptools:         52.0.0-py36h9f7ea03_0                                                                            
    simplejson:         3.17.2-py36hc431981_2                                                                            
    six:                1.15.0-py36h9f7ea03_0                                                                            
    sqlite:             3.35.4-hc431981_0                                                                                
    toml:               0.10.2-pyhd3eb1b0_0                                                                              
    typing_extensions:  3.7.4.3-pyha847dfd_0                                                                             
    tzlocal:            2.1-py36_0                                                                                       
    vc:                 14.2-h21ff451_1                                                                                  
    vs2015_runtime:     14.27.29016-h5e58377_2                                                                           
    wheel:              0.36.2-pyhd3eb1b0_0                                                                              
    wincertstore:       0.2-py36hcdd9a18_0                                                                               
    zipp:               3.4.1-pyhd3eb1b0_0                                                                               

Preparing transaction: ...working... done
Verifying transaction: ...working... done
Executing transaction: ...working... done
Tests failed for arrow-1.1.0-py36h9f7ea03_0.tar.bz2 - moving package to C:\ci\broken
WARNING:conda_build.build:Tests failed for arrow-1.1.0-py36h9f7ea03_0.tar.bz2 - moving package to C:\ci\broken
WARNING conda_build.build:tests_failed(2955): Tests failed for arrow-1.1.0-py36h9f7ea03_0.tar.bz2 - moving package to C:\ci\broken
set PREFIX=C:\ci\arrow_1619685159839\_test_env
set SRC_DIR=C:\ci\arrow_1619685159839\test_tmp

(base) %SRC_DIR%>call "%SRC_DIR%\conda_test_env_vars.bat" 

(base) %SRC_DIR%>set "CONDA_SHLVL="   && 

(base) %SRC_DIR%>conda activate "%PREFIX%" 

(%PREFIX%) %SRC_DIR%>IF 0 NEQ 0 exit /B 1 

(%PREFIX%) %SRC_DIR%>call "%SRC_DIR%\run_test.bat" 

(%PREFIX%) %SRC_DIR%>python -m pip check 
No broken requirements found.

(%PREFIX%) %SRC_DIR%>IF 0 NEQ 0 exit /B 1 

(%PREFIX%) %SRC_DIR%>cd tests   && pytest --cov arrow -k "not parse_tz_name_zzz" 
============================= test session starts =============================
platform win32 -- Python 3.6.13, pytest-6.2.3, py-1.10.0, pluggy-0.13.1
rootdir: %SRC_DIR%\tests
plugins: cov-2.11.1, mock-3.6.0
collected 1714 items / 596 deselected / 1118 selected

test_api.py ....                                                         [  0%]
test_arrow.py .......................................................... [  5%]
........................................................................ [ 11%]
..................................x.x................................... [ 18%]
........                                                                 [ 19%]
test_factory.py ...........F................................             [ 23%]
test_formatter.py ...................................................... [ 27%]
........................................................................ [ 34%]
........................................................................ [ 40%]
........................................................................ [ 47%]
........................................................................ [ 53%]
........................................................................ [ 60%]
........................................................................ [ 66%]
........................................................................ [ 72%]
..............................................................           [ 78%]
test_locales.py ........................................................ [ 83%]
.........................................................                [ 88%]
test_parser.py .................s....................................... [ 93%]
.................................................................        [ 99%]
test_util.py .....                                                       [100%]

================================== FAILURES ===================================
__________________ TestGet.test_one_arg_dateparser_datetime ___________________

self = <tests.test_factory.TestGet object at 0x03DBA6B0>

    def test_one_arg_dateparser_datetime(self):
        dateparser = pytest.importorskip("dateparser")
        expected = datetime(1990, 1, 1).replace(tzinfo=tz.tzutc())
        # dateparser outputs: datetime.datetime(1990, 1, 1, 0, 0, tzinfo=<StaticTzInfo 'UTC\+00:00'>)
>       parsed_date = dateparser.parse("1990-01-01T00:00:00+00:00")

test_factory.py:128: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
..\..\_test_env\lib\site-packages\dateparser\conf.py:89: in wrapper
    return f(*args, **kwargs)
..\..\_test_env\lib\site-packages\dateparser\__init__.py:54: in parse
    data = parser.get_date_data(date_string, date_formats)
..\..\_test_env\lib\site-packages\dateparser\date.py:420: in get_date_data
    for locale in self._get_applicable_locales(date_string):
..\..\_test_env\lib\site-packages\dateparser\date.py:469: in _get_applicable_locales
    if self._is_applicable_locale(locale, s):
..\..\_test_env\lib\site-packages\dateparser\date.py:476: in _is_applicable_locale
    settings=self._settings)
..\..\_test_env\lib\site-packages\dateparser\languages\locale.py:72: in is_applicable
    date_tokens = dictionary.split(date_string)
..\..\_test_env\lib\site-packages\dateparser\languages\dictionary.py:142: in split
    tokens[i] = self._split_by_known_words(token, keep_formatting)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _TESTS FAILED: arrow-1.1.0-py36h9f7ea03_0.tar.bz2
 _ _ _ _ _ _

self = <dateparser.languages.dictionary.NormalizedDictionary object at 0x0394F250>
string = '1990-01-01t00:00:00+00:00', keep_formatting = False

    def _split_by_known_words(self, string, keep_formatting):
        if not string:
            return string

        regex = self._get_split_regex_cache()
        match = regex.match(string)
>       if not match:
E       SystemError: error return without exception set

..\..\_test_env\lib\site-packages\dateparser\languages\dictionary.py:152: SystemError

---------- coverage: platform win32, python 3.6.13-final-0 -----------
Name                                                                       Stmts   Miss  Cover
----------------------------------------------------------------------------------------------
%PREFIX%\Lib\site-packages\arrow\__init__.py        7      0   100%
%PREFIX%\Lib\site-packages\arrow\_version.py        1      0   100%
%PREFIX%\Lib\site-packages\arrow\api.py            30      0   100%
%PREFIX%\Lib\site-packages\arrow\arrow.py         551      4    99%
%PREFIX%\Lib\site-packages\arrow\constants.py      11      0   100%
%PREFIX%\Lib\site-packages\arrow\factory.py        86      0   100%
%PREFIX%\Lib\site-packages\arrow\formatter.py     102      0   100%
%PREFIX%\Lib\site-packages\arrow\locales.py       868      0   100%
%PREFIX%\Lib\site-packages\arrow\parser.py        313      0   100%
%PREFIX%\Lib\site-packages\arrow\util.py           45      0   100%
----------------------------------------------------------------------------------------------
TOTAL                                                                       2014      4    99%

=========================== short test summary info ===========================
FAILED test_factory.py::TestGet::test_one_arg_dateparser_datetime - SystemErr...
==== 1 failed, 1114 passed, 1 skipped, 596 deselected, 2 xfailed in 12.82s ====

(%PREFIX%) %SRC_DIR%\tests>IF 1 NEQ 0 exit /B 1 

(%PREFIX%) %SRC_DIR%\tests>IF 1 NEQ 0 exit /B 1 

System Info

systemcatch commented 3 years ago

Weird I have no idea why this is failing as all our CI builds are green and we have pinned dateparser at 1.0.* for ages in our requirements.

Looking at dateparser's code the error is being raised here, I'm guessing this is something specific to the win32 platform.

systemcatch commented 3 years ago

Closing this for now as we can't reproduce our end, let us know if we should reopen.