Skip to content

Commit

Permalink
Add pre-commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
Stranger6667 committed Oct 21, 2019
1 parent 6d19d16 commit 004aa03
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 8 deletions.
22 changes: 22 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
default_language_version:
python: python3.7

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/ambv/black
rev: stable
hooks:
- id: black
types: [python]
args: [-l 120]

- repo: https://github.com/pre-commit/mirrors-isort
rev: v4.3.15
hooks:
- id: isort
args: [--line-width=120, --multi-line=3, --project=pytest_recording, --section-default=THIRDPARTY, --trailing-comma]
2 changes: 1 addition & 1 deletion src/pytest_recording/network.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from contextlib import contextmanager
import socket
import sys
from contextlib import contextmanager

import attr

Expand Down
2 changes: 1 addition & 1 deletion src/pytest_recording/plugin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
from itertools import chain
import os
from itertools import chain

import pytest

Expand Down
3 changes: 2 additions & 1 deletion tests/test_plugin.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# -*- coding: utf-8 -*-
import pytest
from pytest_recording.plugin import RECORD_MODES
from pluggy.manager import PluginManager

from pytest_recording.plugin import RECORD_MODES


@pytest.mark.parametrize(
"args, expected", [(("--record-mode={}".format(mode),), mode) for mode in RECORD_MODES] + [((), "none")]
Expand Down
10 changes: 5 additions & 5 deletions tests/test_recording.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,18 +220,18 @@ def test_one(vcr):
def test_two(vcr):
request = make_request(
uri="https://www.example.com?api_key=secret",
headers={"authorization": "something"},
headers={"authorization": "something"},
query=(("api_key", "secret"),)
)
processed = vcr._before_record_request(request)
assert processed.headers == {}
assert processed.uri == "https://www.example.com"
# Check `ignore_localhost`
request = make_request(
uri="http://127.0.0.1",
host="127.0.0.1",
headers={"authorization": "something"},
uri="http://127.0.0.1",
host="127.0.0.1",
headers={"authorization": "something"},
query=(("api_key", "secret"),)
)
assert vcr._before_record_request(request) is None
Expand Down
1 change: 1 addition & 0 deletions tests/test_replaying.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pytest

from pytest_recording._vcr import load_cassette


Expand Down
1 change: 1 addition & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pytest

from pytest_recording.utils import unique


Expand Down

0 comments on commit 004aa03

Please sign in to comment.