Open boyanpenkov opened 1 year ago
There was some suspicion about my conda env, since papers --version
and papers -h
didn't work, but I reinstalled it (all from conda-forge), the papers commands work, but the problem persists.
OK, this is tox
being too smart for it's own good, since if I just run the test string pytest --cov=papers --cov-append --cov-report=term-missing -xv
I get 100% pass on all 145 tests.
Looking at this now..
Based on https://github.com/pre-commit/pre-commit-hooks/issues/402 I think we may need a HOME = {homedir}
somewhere, but since we don't have a tox.ini
not sure where...
OK, so, trying this:
-- I confirm I have HOME = os.environ.get('HOME',os.path.expanduser('~'))
in papers/config.py
and that this executes cleanly on my machine:
Python 3.11.3 (main, Apr 19 2023, 23:54:32) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> HOME = os.environ.get('HOME',os.path.expanduser('~'))
>>> print(HOME)
/home/boyan
>>>
-- adding the homedir explicitly to pyproject.toml
, which should be a global tox substitution:
[tool.tox]
# Tox (https://tox.readthedocs.io/) is a tool for running tests
# in multiple virtualenvs. This configuration file will run the
# test suite on all supported python versions. To use it, "pip install tox"
# and then run "tox" from this directory.
legacy_tox_ini = "HOME={homedir}"
[tox]
envlist = clean, py38, py39, py310, py311, report
fails with a tox "internal error"
I'm not sure what's the correct way of setting the home directory, but your snippet has a syntax error. legacy_tox_ini
opens a triple quote and it's closed further down. Should be like that:
legacy_tox_ini = """
HOME={homedir}
...
"""
See syntax highlighting here: https://github.com/perrette/papers/blob/master/pyproject.toml
Yes, you're totally right here -- I'm looking at this in https://github.com/perrette/papers/pull/59 and now have the $HOME set, I think correctly, but now the synthetic object that exists for backup seens the wrong directory:
tests/test_install.py::TestDefaultLocal2::test_install FAILED [ 82%]
============================================================================================== FAILURES ==============================================================================================
___________________________________________________________________________________ TestDefaultLocal2.test_install ___________________________________________________________________________________
tests/common.py:224: in setUp
self.config = Config.load(CONFIG_FILE)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'papers.config.Config'>, file = '{homedir}/.local/share/config.json'
@classmethod
def load(cls, file):
> js = json.load(open(file))
E FileNotFoundError: [Errno 2] No such file or directory: '{homedir}/.local/share/config.json'
papers/config.py:121: FileNotFoundError
---------------------------------------------------------------------------------------- Captured stdout call ----------------------------------------------------------------------------------------
papers configuration (global)
version 2.3.dev134+g88d6f6c.d20230510
* configuration file: {homedir}/.local/share/config.json
* cache directory: {homedir}/.cache/papers
* absolute paths: True
* git-tracked: False
* editor: None
* files directory: filesxyz (empty)
* bibtex: papersxyz.bib (empty)
----------------------------------------------------------------------------------------- Captured log call ------------------------------------------------------------------------------------------
INFO papers:__main__.py:285 create empty bibliography database: papersxyz.bib
INFO papers:__main__.py:292 create empty files directory: filesxyz
INFO papers:__main__.py:327 save config file: {homedir}/.local/share/config.json
========================================================================================== warnings summary ==========================================================================================
Actually, for this thing -- is there a way to try with tox 4.4.4 someway? https://github.com/tox-dev/tox/issues/2702 looking now...
yep, confirming pip install tox==4.5.1
does not fix anything; bummer...
After https://github.com/perrette/papers/pull/53 -- which is a good idea! -- I see:
Not sure what the thing is here...