mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-06-28 05:26:13 +02:00
Notify user when config directory can't be created because there is already a file with the same name (#1134)
* Moving configuration values and methods from install.py to config.py -- everything is broken right now * Using context to store config path - still lots broken * Use mocks and context.config_path to store test configs - many tests still broken though * Update changelog [ci skip] * Fix jrnl --ls crash * Fix crash when no editor configured * Attempt to patch config path with test data - doesn't appear to be working * Properly use patched config path and add config given to scenario that wasn't using it * Fix copypasta * Fix editor test that needed patched config and trapping for system exit * Add exception and handling for when configuration directory is actually a file * Remove extraneous comment * Use more generic JrnlError with messaging switchboard * Format code a bit nicer * Remove unnecessary given in diagnostic test * Ensure full error message is output * Remove unnecessary whitespace characters
This commit is contained in:
parent
e0c53c28bb
commit
c155bafa84
8 changed files with 182 additions and 97 deletions
19
tests/test_exception.py
Normal file
19
tests/test_exception.py
Normal file
|
@ -0,0 +1,19 @@
|
|||
import textwrap
|
||||
|
||||
from jrnl.exception import JrnlError
|
||||
|
||||
|
||||
def test_config_directory_exception_message():
|
||||
ex = JrnlError(
|
||||
"ConfigDirectoryIsFile", config_directory_path="/config/directory/path"
|
||||
)
|
||||
|
||||
assert ex.message == textwrap.dedent(
|
||||
"""
|
||||
The path to your jrnl configuration directory is a file, not a directory:
|
||||
|
||||
/config/directory/path
|
||||
|
||||
Removing this file will allow jrnl to save its configuration.
|
||||
"""
|
||||
)
|
Loading…
Add table
Add a link
Reference in a new issue