arrow-py / arrow

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

Tox lint failing when run from dist tarball (non-git repo) #864

Closed kloczek closed 3 years ago

kloczek commented 4 years ago

[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.5,idna==2.10,imagesize==1.2.0,iniconfig==1.0.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.9.27,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.33
py38 run-test-pre: PYTHONHASHSEED='1372572479'
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.75s ===================================================================================
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.5,nodeenv==1.5.0,pre-commit==2.7.1,PyYAML==5.3.1,six==1.15.0,toml==0.10.1,virtualenv==20.0.33
lint run-test-pre: PYTHONHASHSEED='1372572479'
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='1372572479'
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
jadchaar commented 4 years ago

Hi @kloczek, it seems like the lint command is failing due to an issue with git not being installed:

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)

Would you mind taking a look at the pre-commit.log file to see if there is any extra information regarding this issue?

I just rantox on my end with success:

____________________________________________________________ summary ____________________________________________________________
SKIPPED:  pypy3: InterpreterNotFound: pypy3
  py27: commands succeeded
SKIPPED:  py35: InterpreterNotFound: python3.5
SKIPPED:  py36: InterpreterNotFound: python3.6
SKIPPED:  py37: InterpreterNotFound: python3.7
  py38: commands succeeded
SKIPPED:  py39: InterpreterNotFound: python3.9
  lint: commands succeeded
  docs: commands succeeded
  congratulations :)

Also, mind including information on how you are building arrow? Are you cloning the git repo? Or are you using the version from PyPI?

jadchaar commented 4 years ago

Feel free to re-open this issue if the errors persists, but I am going to close this for now.

jadchaar commented 4 years ago

After looking into this more, it seems like you have downloaded the tar from PyPI https://pypi.org/project/arrow/#files and extracted it before running tox. It makes sense that lint would fail since it uses pre-commit hooks, which do not work outside of a git repository. We should probably enlist a standalone solution for linting outside of a git repo.

kloczek commented 4 years ago

I'm sorry that I did not reply sending log but I was a bit busy :/

jadchaar commented 4 years ago

No problem. Since we rely on pre-commit for linting, it might be best if we just check for the presence of a git repo (e.g. .git folder), and if we don't find it, just pass the lint command.