Use XDG_DATA_HOME for history and refresh token.

This commit is contained in:
Caleb Perkins
2017-12-26 22:09:37 -08:00
parent 1b3a13a4df
commit 45ed75a6e0
3 changed files with 9 additions and 8 deletions

View File

@@ -92,11 +92,11 @@ This both speeds up the tests and helps to maintain consistency across runs.
4. By default, the cassettes will act as read-only.
If you have written a new test and would like to record a cassette, you must provide your own refresh token.
The easiest thing to do is to use the token generated by RTV when you log in.
This is usually stored as *~/.config/rtv/refresh-token*.
This is usually stored as *~/.local/share/rtv/refresh-token*.
.. code-block:: bash
$ python -m pytest ~/code/rtv/tests/ --record-mode once --refresh-token ~/.config/rtv/refresh-token
$ python -m pytest ~/code/rtv/tests/ --record-mode once --refresh-token ~/.local/share/rtv/refresh-token
================================ test session starts ================================
platform linux -- Python 3.4.0, pytest-2.9.2, py-1.4.31, pluggy-0.3.1
rootdir: ~/code/rtv/, inifile:

View File

@@ -20,12 +20,13 @@ TEMPLATES = os.path.join(PACKAGE, 'templates')
DEFAULT_CONFIG = os.path.join(TEMPLATES, 'rtv.cfg')
DEFAULT_MAILCAP = os.path.join(TEMPLATES, 'mailcap')
DEFAULT_THEMES = os.path.join(PACKAGE, 'themes')
XDG_HOME = os.getenv('XDG_CONFIG_HOME', os.path.join(HOME, '.config'))
CONFIG = os.path.join(XDG_HOME, 'rtv', 'rtv.cfg')
XDG_CONFIG_HOME = os.getenv('XDG_CONFIG_HOME', os.path.join(HOME, '.config'))
XDG_DATA_HOME = os.getenv('XDG_DATA_HOME', os.path.join(HOME, '.local', 'share'))
CONFIG = os.path.join(XDG_CONFIG_HOME, 'rtv', 'rtv.cfg')
MAILCAP = os.path.join(HOME, '.mailcap')
TOKEN = os.path.join(XDG_HOME, 'rtv', 'refresh-token')
HISTORY = os.path.join(XDG_HOME, 'rtv', 'history.log')
THEMES = os.path.join(XDG_HOME, 'rtv', 'themes')
TOKEN = os.path.join(XDG_DATA_HOME, 'rtv', 'refresh-token')
HISTORY = os.path.join(XDG_DATA_HOME, 'rtv', 'history.log')
THEMES = os.path.join(XDG_CONFIG_HOME, 'rtv', 'themes')
def build_parser():

View File

@@ -40,7 +40,7 @@ for name in ['vcr.matchers', 'vcr.stubs']:
def pytest_addoption(parser):
parser.addoption('--record-mode', dest='record_mode', default='none')
parser.addoption('--refresh-token', dest='refresh_token',
default='~/.config/rtv/refresh-token')
default='~/.local/share/rtv/refresh-token')
class MockStdscr(mock.MagicMock):