Skip to content

Commit

Permalink
make snapshot cross python
Browse files Browse the repository at this point in the history
  • Loading branch information
jondot committed May 8, 2019
1 parent 6a18977 commit e864096
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 75 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ yarn-error.log
cov.xml
node_modules/
_book/
pip-wheel-metadata/
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pytest = "^3.0"
pytest-benchmark = "^3.1"
pytest-testmon = "^0.9.13"
pytest-watch = "^4.2"
snapshottest = "^0.5.0"
snapshottest = { git = "https://github.com/jondot/snapshottest", branch="serialize-snapshots" }

flake8 = { version = "^3.5" }
requests = "^2.20"
Expand Down
37 changes: 29 additions & 8 deletions tests/snapshots/snap_test_breaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,34 @@

snapshots = Snapshot()

snapshots["test_circuit_breaker_middleware 1"] = [
snapshots['test_circuit_breaker_middleware 1'] = '''[
[
"warn",
"circuitbreaker.state_changed",
{"name": "test-cb", "new_state": "open", "old_state": "closed"},
{},
'warn',
'circuitbreaker.state_changed',
{
'name': 'test-cb',
'new_state': 'open',
'old_state': 'closed'
},
{
}
],
["info", "circuitbreaker.open", {"name": "test-cb"}, {}],
["info", "circuitbreaker.open", {"name": "test-cb"}, {}],
]
[
'info',
'circuitbreaker.open',
{
'name': 'test-cb'
},
{
}
],
[
'info',
'circuitbreaker.open',
{
'name': 'test-cb'
},
{
}
]
]'''
114 changes: 57 additions & 57 deletions tests/snapshots/snap_test_client.py

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions tests/snapshots/snap_test_for_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

snapshots = Snapshot()

snapshots['test_apply_params 1'] = (
snapshots['test_apply_params 1'] = '''(
'http://github.com/jondot/formation?q=foobar',
{
'foobar': 'foobaz'
}
)
)'''
4 changes: 2 additions & 2 deletions tests/snapshots/snap_test_formation.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

snapshots = Snapshot()

snapshots['test_formation 1'] = {
snapshots['test_formation 1'] = '''{
'status_from_middleware': 200,
'status_from_request': 200
}
}'''
8 changes: 4 additions & 4 deletions tests/snapshots/snap_test_request_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

snapshots = Snapshot()

snapshots['test_default_stack 1'] = [
snapshots['test_default_stack 1'] = '''[
[
'info',
'request.http',
Expand Down Expand Up @@ -106,9 +106,9 @@
'v': '0.01'
}
]
]
]'''

snapshots['test_default_stack 2'] = {
snapshots['test_default_stack 2'] = '''{
'env': 'local',
'ns': 'service',
'pid': 'pid-1',
Expand All @@ -119,4 +119,4 @@
'tid': 'tid-1',
'uid': None,
'v': '0.01'
}
}'''
2 changes: 1 addition & 1 deletion website/sidebars.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"examples/scraping"
],
"Middleware": [
"middleware/middleware-accept",
"middleware/accept",
"middleware/breaker",
"middleware/context-logger",
"middleware/context",
Expand Down

0 comments on commit e864096

Please sign in to comment.