arrow-py / arrow

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

0.17.0: test suite is failing #869

Closed kloczek closed 3 years ago

kloczek commented 3 years ago

I've skipped all bug rapot details because all is in tox output. Looks like tox test suite cannot be used with dist tar ball and want to be executed in git tree. How to remove that pre-commit test on which everything is failing? 100% tests are OK axcept that pre-commit.

[tkloczko@barrel arrow-0.17.0]$ tox --skip-missing-interpreters
.tox create: /home/tkloczko/rpmbuild/BUILD/arrow-0.17.0/.tox/.tox
.tox installdeps: tox >= 3.18.0
GLOB sdist-make: /home/tkloczko/rpmbuild/BUILD/arrow-0.17.0/setup.py
pypy3 create: /home/tkloczko/rpmbuild/BUILD/arrow-0.17.0/.tox/pypy3
SKIPPED: InterpreterNotFound: pypy3
py27 create: /home/tkloczko/rpmbuild/BUILD/arrow-0.17.0/.tox/py27
SKIPPED: InterpreterNotFound: python2.7
py35 create: /home/tkloczko/rpmbuild/BUILD/arrow-0.17.0/.tox/py35
SKIPPED: InterpreterNotFound: python3.5
py36 create: /home/tkloczko/rpmbuild/BUILD/arrow-0.17.0/.tox/py36
SKIPPED: InterpreterNotFound: python3.6
py37 create: /home/tkloczko/rpmbuild/BUILD/arrow-0.17.0/.tox/py37
SKIPPED: InterpreterNotFound: python3.7
py38 create: /home/tkloczko/rpmbuild/BUILD/arrow-0.17.0/.tox/py38
py38 installdeps: -rrequirements.txt
py38 inst: /home/tkloczko/rpmbuild/BUILD/arrow-0.17.0/.tox/.tmp/package/1/arrow-0.17.0.zip
py38 installed: alabaster==0.7.12,appdirs==1.4.4,arrow @ file:///home/tkloczko/rpmbuild/BUILD/arrow-0.17.0/.tox/.tmp/package/1/arrow-0.17.0.zip,attrs==20.2.0,Babel==2.8.0,certifi==2020.6.20,cfgv==3.2.0,chardet==3.0.4,coverage==5.3,dateparser==0.7.6,distlib==0.3.1,docutils==0.16,filelock==3.0.12,identify==1.5.6,idna==2.10,imagesize==1.2.0,iniconfig==1.1.1,Jinja2==2.11.2,MarkupSafe==1.1.1,more-itertools==8.5.0,nodeenv==1.5.0,packaging==20.4,pluggy==0.13.1,pre-commit==2.6.0,py==1.9.0,Pygments==2.7.1,pyparsing==2.4.7,pytest==6.0.2,pytest-cov==2.10.1,pytest-mock==3.2.0,python-dateutil==2.8.1,pytz==2019.3,PyYAML==5.3.1,regex==2020.10.15,requests==2.24.0,simplejson==3.17.2,six==1.15.0,snowballstemmer==2.0.0,Sphinx==3.2.1,sphinxcontrib-applehelp==1.0.2,sphinxcontrib-devhelp==1.0.2,sphinxcontrib-htmlhelp==1.0.3,sphinxcontrib-jsmath==1.0.1,sphinxcontrib-qthelp==1.0.3,sphinxcontrib-serializinghtml==1.1.4,toml==0.10.1,tzlocal==2.1,urllib3==1.25.10,virtualenv==20.0.35
py38 run-test-pre: PYTHONHASHSEED='1765374433'
py38 run-test: commands[0] | pytest
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.3, pytest-6.0.2, py-1.9.0, pluggy-0.13.1 -- /home/tkloczko/rpmbuild/BUILD/arrow-0.17.0/.tox/py38/bin/python
cachedir: .tox/py38/.pytest_cache
rootdir: /home/tkloczko/rpmbuild/BUILD/arrow-0.17.0, configfile: tox.ini, testpaths: tests
plugins: cov-2.10.1, mock-3.2.0
collected 1660 items

tests/test_api.py::TestModule::test_get PASSED                                                                                                                       [  0%]

[..]

tests/test_util.py::TestUtil::test_iso_gregorian PASSED                                                                                                              [100%]

============================================================================= warnings summary =============================================================================
tests/test_arrow.py::TestArrowAttribute::test_timestamp
tests/test_arrow.py::TestArrowAttribute::test_float_timestamp
tests/test_factory.py::TestGet::test_timestamp_one_arg_no_arg
tests/test_factory.py::TestGet::test_timestamp_one_arg_no_arg
  /home/tkloczko/rpmbuild/BUILD/arrow-0.17.0/arrow/arrow.py:703: DeprecationWarning: For compatibility with the datetime.timestamp() method this property will be replaced with a method in the 1.0.0 release, please switch to the .int_timestamp property for identical behaviour as soon as possible.
    warnings.warn(

-- Docs: https://docs.pytest.org/en/stable/warnings.html

----------- coverage: platform linux, python 3.8.3-final-0 -----------
Name                 Stmts   Miss Branch BrPart  Cover   Missing
----------------------------------------------------------------
arrow/__init__.py        6      0      0      0   100%
arrow/_version.py        1      0      0      0   100%
arrow/api.py            16      0      0      0   100%
arrow/arrow.py         489      0    220      0   100%
arrow/constants.py       3      0      0      0   100%
arrow/factory.py        77      0     48      0   100%
arrow/formatter.py     100      0     72      0   100%
arrow/locales.py       801      0    124      0   100%
arrow/parser.py        277      0    142      0   100%
arrow/util.py           43      0     18      0   100%
----------------------------------------------------------------
TOTAL                 1813      0    624      0   100%
Coverage XML written to file coverage.xml

Required test coverage of 100% reached. Total coverage: 100.00%
===================================================================== 1660 passed, 4 warnings in 7.86s =====================================================================
py39 create: /home/tkloczko/rpmbuild/BUILD/arrow-0.17.0/.tox/py39
SKIPPED: InterpreterNotFound: python3.9
lint create: /home/tkloczko/rpmbuild/BUILD/arrow-0.17.0/.tox/lint
lint installdeps: pre-commit
lint installed: appdirs==1.4.4,cfgv==3.2.0,distlib==0.3.1,filelock==3.0.12,identify==1.5.6,nodeenv==1.5.0,pre-commit==2.7.1,PyYAML==5.3.1,six==1.15.0,toml==0.10.1,virtualenv==20.0.35
lint run-test-pre: PYTHONHASHSEED='1765374433'
lint run-test: commands[0] | pre-commit install
An error has occurred: FatalError: git failed. Is it installed, and are you in a Git repository directory?
Check the log at /home/tkloczko/.cache/pre-commit/pre-commit.log
ERROR: InvocationError for command /home/tkloczko/rpmbuild/BUILD/arrow-0.17.0/.tox/lint/bin/pre-commit install (exited with code 1)
docs create: /home/tkloczko/rpmbuild/BUILD/arrow-0.17.0/.tox/docs
docs installdeps: doc8, sphinx, python-dateutil
docs installed: alabaster==0.7.12,Babel==2.8.0,certifi==2020.6.20,chardet==3.0.4,doc8==0.8.1,docutils==0.16,idna==2.10,imagesize==1.2.0,Jinja2==2.11.2,MarkupSafe==1.1.1,packaging==20.4,pbr==5.5.0,Pygments==2.7.1,pyparsing==2.4.7,python-dateutil==2.8.1,pytz==2020.1,requests==2.24.0,restructuredtext-lint==1.3.1,six==1.15.0,snowballstemmer==2.0.0,Sphinx==3.2.1,sphinxcontrib-applehelp==1.0.2,sphinxcontrib-devhelp==1.0.2,sphinxcontrib-htmlhelp==1.0.3,sphinxcontrib-jsmath==1.0.1,sphinxcontrib-qthelp==1.0.3,sphinxcontrib-serializinghtml==1.1.4,stevedore==3.2.2,urllib3==1.25.10
docs run-test-pre: PYTHONHASHSEED='1765374433'
docs run-test: commands[0] | doc8 index.rst ../README.rst --extension .rst --ignore D001
Scanning...
Validating...
========
Total files scanned = 2
Total files ignored = 0
Total accumulated errors = 0
Detailed error counts:
    - doc8.checks.CheckCarriageReturn = 0
    - doc8.checks.CheckIndentationNoTab = 0
    - doc8.checks.CheckMaxLineLength = 0
    - doc8.checks.CheckNewlineEndOfFile = 0
    - doc8.checks.CheckTrailingWhitespace = 0
    - doc8.checks.CheckValidity = 0
docs run-test: commands[1] | make html 'SPHINXOPTS=-W --keep-going'
Running Sphinx v3.2.1
making output directory... done
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 2 source files that are out of date
updating environment: [new config] 2 added, 0 changed, 0 removed
reading sources... [ 50%] index
reading sources... [100%] releases

looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [ 50%] index
writing output... [100%] releases

generating indices...  genindex py-modindexdone
writing additional pages...  searchdone
copying static files... ... done
copying extra files... done
dumping search index in English (code: en)... done
dumping object inventory... done
build succeeded.

The HTML pages are in _build/html.
_________________________________________________________________________________ summary __________________________________________________________________________________
SKIPPED:  pypy3: InterpreterNotFound: pypy3
SKIPPED:  py27: InterpreterNotFound: python2.7
SKIPPED:  py35: InterpreterNotFound: python3.5
SKIPPED:  py36: InterpreterNotFound: python3.6
SKIPPED:  py37: InterpreterNotFound: python3.7
  py38: commands succeeded
SKIPPED:  py39: InterpreterNotFound: python3.9
ERROR:   lint: commands failed
  docs: commands succeeded
[tkloczko@barrel SPECS]$ cat /home/tkloczko/.cache/pre-commit/pre-commit.log
### version information

pre-commit version: 2.7.1
sys.version:
    3.8.3 (default, May 15 2020, 18:27:29)
    [GCC 10.1.1 20200507 (Red Hat 10.1.1-1)]
sys.executable: /home/tkloczko/rpmbuild/BUILD/arrow-0.17.0/.tox/lint/bin/python
os.name: posix
sys.platform: linux

### error information

An error has occurred: FatalError: git failed. Is it installed, and are you in a Git repository directory?

Traceback (most recent call last):
  File "/home/tkloczko/rpmbuild/BUILD/arrow-0.17.0/.tox/lint/lib/python3.8/site-packages/pre_commit/main.py", line 150, in _adjust_args_and_chdir
    toplevel = git.get_root()
  File "/home/tkloczko/rpmbuild/BUILD/arrow-0.17.0/.tox/lint/lib/python3.8/site-packages/pre_commit/git.py", line 46, in get_root
    return cmd_output('git', 'rev-parse', '--show-toplevel')[1].strip()
  File "/home/tkloczko/rpmbuild/BUILD/arrow-0.17.0/.tox/lint/lib/python3.8/site-packages/pre_commit/util.py", line 163, in cmd_output
    returncode, stdout_b, stderr_b = cmd_output_b(*cmd, **kwargs)
  File "/home/tkloczko/rpmbuild/BUILD/arrow-0.17.0/.tox/lint/lib/python3.8/site-packages/pre_commit/util.py", line 157, in cmd_output_b
    raise CalledProcessError(returncode, cmd, retcode, stdout_b, stderr_b)
pre_commit.util.CalledProcessError: command: ('/usr/bin/git', 'rev-parse', '--show-toplevel')
return code: 128
expected return code: 0
stdout: (none)
stderr:
    fatal: not a git repository (or any parent up to mount point /home/tkloczko)
    Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/tkloczko/rpmbuild/BUILD/arrow-0.17.0/.tox/lint/lib/python3.8/site-packages/pre_commit/error_handler.py", line 63, in error_handler
    yield
  File "/home/tkloczko/rpmbuild/BUILD/arrow-0.17.0/.tox/lint/lib/python3.8/site-packages/pre_commit/main.py", line 343, in main
    _adjust_args_and_chdir(args)
  File "/home/tkloczko/rpmbuild/BUILD/arrow-0.17.0/.tox/lint/lib/python3.8/site-packages/pre_commit/main.py", line 152, in _adjust_args_and_chdir
    raise FatalError(
pre_commit.error_handler.FatalError: git failed. Is it installed, and are you in a Git repository directory?
jadchaar commented 3 years ago

Hi @kloczek, I am closing this in favor of your other post https://github.com/arrow-py/arrow/issues/864.

The solution to this is to only run the test suites: tox -e py27,py35,py36,py37,py38,py39 --skip-missing-interpreters. I am thinking of a way to elegantly add linting to tox since we rely on pre-commit for it.

kloczek commented 3 years ago

As I'm working on multiple packages I forgot to add to my spec refference to the prev ticket :/ My fault. Sorry.

jadchaar commented 3 years ago

No problem! This issue has been on my mind, and I am still trying to figure out the best solution. I wish there was a way to skip test environments easily in Tox. Do you know of a way to do this @kloczek ?

kloczek commented 3 years ago

With suggested in your prev comment command tox -e py27,py35,py36,py37,py38,py39 --skip-missing-interpreters you gave me hint of what I need to modify to not have lint executet on running my standard tox command which I'm trying to use across all my python packages which are using tox in test suite framework which is tox --skip-missing-interpreters. I've just added to my package patch:

--- a/tox.ini~
+++ b/tox.ini
@@ -1,6 +1,6 @@
 [tox]
 minversion = 3.18.0
-envlist = py{py3,27,35,36,37,38,39},lint,docs
+envlist = py{py3,27,35,36,37,38,39},docs
 skip_missing_interpreters = true

 [gh-actions]

This patch only removes lint from default set of targets however lint looks like still should be available (please correct me if I'm wrong). I think that you could apply that patch and use explicite tox lint in your CI.

jadchaar commented 3 years ago

Ah yeah, I guess that makes sense. I am going to remove lint and docs targets from the default tox command since they are primarily used in CI. I will submit a PR to get this fixed. Thanks for bringing it up!