Use XDG_DATA_HOME for history and refresh token.
This commit is contained in:
@@ -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.
|
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.
|
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.
|
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
|
.. 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 ================================
|
================================ test session starts ================================
|
||||||
platform linux -- Python 3.4.0, pytest-2.9.2, py-1.4.31, pluggy-0.3.1
|
platform linux -- Python 3.4.0, pytest-2.9.2, py-1.4.31, pluggy-0.3.1
|
||||||
rootdir: ~/code/rtv/, inifile:
|
rootdir: ~/code/rtv/, inifile:
|
||||||
|
|||||||
@@ -20,12 +20,13 @@ TEMPLATES = os.path.join(PACKAGE, 'templates')
|
|||||||
DEFAULT_CONFIG = os.path.join(TEMPLATES, 'rtv.cfg')
|
DEFAULT_CONFIG = os.path.join(TEMPLATES, 'rtv.cfg')
|
||||||
DEFAULT_MAILCAP = os.path.join(TEMPLATES, 'mailcap')
|
DEFAULT_MAILCAP = os.path.join(TEMPLATES, 'mailcap')
|
||||||
DEFAULT_THEMES = os.path.join(PACKAGE, 'themes')
|
DEFAULT_THEMES = os.path.join(PACKAGE, 'themes')
|
||||||
XDG_HOME = os.getenv('XDG_CONFIG_HOME', os.path.join(HOME, '.config'))
|
XDG_CONFIG_HOME = os.getenv('XDG_CONFIG_HOME', os.path.join(HOME, '.config'))
|
||||||
CONFIG = os.path.join(XDG_HOME, 'rtv', 'rtv.cfg')
|
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')
|
MAILCAP = os.path.join(HOME, '.mailcap')
|
||||||
TOKEN = os.path.join(XDG_HOME, 'rtv', 'refresh-token')
|
TOKEN = os.path.join(XDG_DATA_HOME, 'rtv', 'refresh-token')
|
||||||
HISTORY = os.path.join(XDG_HOME, 'rtv', 'history.log')
|
HISTORY = os.path.join(XDG_DATA_HOME, 'rtv', 'history.log')
|
||||||
THEMES = os.path.join(XDG_HOME, 'rtv', 'themes')
|
THEMES = os.path.join(XDG_CONFIG_HOME, 'rtv', 'themes')
|
||||||
|
|
||||||
|
|
||||||
def build_parser():
|
def build_parser():
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ for name in ['vcr.matchers', 'vcr.stubs']:
|
|||||||
def pytest_addoption(parser):
|
def pytest_addoption(parser):
|
||||||
parser.addoption('--record-mode', dest='record_mode', default='none')
|
parser.addoption('--record-mode', dest='record_mode', default='none')
|
||||||
parser.addoption('--refresh-token', dest='refresh_token',
|
parser.addoption('--refresh-token', dest='refresh_token',
|
||||||
default='~/.config/rtv/refresh-token')
|
default='~/.local/share/rtv/refresh-token')
|
||||||
|
|
||||||
|
|
||||||
class MockStdscr(mock.MagicMock):
|
class MockStdscr(mock.MagicMock):
|
||||||
|
|||||||
Reference in New Issue
Block a user