-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #127 from jacebrowning/enable-old-serialization
Add an option to use unindented YAML blocks
- Loading branch information
Showing
9 changed files
with
109 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
"""Shared configuration flags.""" | ||
|
||
HOOKS_ENABLED = True | ||
|
||
HIDE_TRACEBACK_IN_HOOKS = True | ||
HOOKS_ENABLED = True | ||
INDENT_YAML_BLOCKS = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<h1>Settings</h1> | ||
|
||
For libraries that wish to temporarly alter any of the previosly described behavior, a handful of settings can be set at the module level. All boolean settings default to `True` unless otherwise noted. | ||
|
||
# `HIDE_TRACEBACK_IN_HOOKS` | ||
|
||
When an exception occurs in patched method, this traceback is hidden by default for `pytest`. If this information is required to debug a complex issue enable it as follows: | ||
|
||
```python | ||
import datafiles | ||
|
||
datafiles.settings.HIDE_TRACEBACK_IN_HOOKS = False | ||
``` | ||
|
||
# `HOOKS_ENABLED` | ||
|
||
When running unit tests for a library using `datafiles`, | ||
it can be helpful to disable automatic loading/saving in patched methods for performance: | ||
|
||
```python | ||
def pytest_runtest_setup(item): | ||
"""Disable file storage during unit tests.""" | ||
datafiles.settings.HOOKS_ENABLED = False | ||
``` | ||
|
||
|
||
|
||
# `INDENT_YAML_BLOCKS` | ||
|
||
In `datafiles >= 0.4`, YAML blocks are now indented by default, like so: | ||
|
||
```yaml | ||
items: | ||
- 1 | ||
- 2 | ||
- 3 | ||
``` | ||
|
||
To make it easier to upgrade to this version, a library can disable this functionality: | ||
|
||
```python | ||
import datafiles | ||
|
||
datafiles.settings.INDENT_YAML_BLOCKS = False | ||
``` | ||
|
||
to produce YAML like: | ||
|
||
```yaml | ||
items: | ||
- 1 | ||
- 2 | ||
- 3 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters