mirror of
https://github.com/httpie/cli.git
synced 2024-11-24 08:22:22 +02:00
Avoid “__init__.py” files in test directories.
As recommended here: https://pytest.org/latest/goodpractises.html
This commit is contained in:
parent
faec00fd99
commit
2aa53e4be3
@ -1,4 +1,5 @@
|
||||
import os
|
||||
"""Test data"""
|
||||
from os import path
|
||||
import codecs
|
||||
|
||||
|
||||
@ -11,10 +12,10 @@ def patharg(path):
|
||||
return path.replace('\\', '\\\\\\')
|
||||
|
||||
|
||||
FIXTURES_ROOT = os.path.abspath(os.path.dirname(__file__))
|
||||
FILE_PATH = os.path.join(FIXTURES_ROOT, 'test.txt')
|
||||
JSON_FILE_PATH = os.path.join(FIXTURES_ROOT, 'test.json')
|
||||
BIN_FILE_PATH = os.path.join(FIXTURES_ROOT, 'test.bin')
|
||||
FIXTURES_ROOT = path.join(path.abspath(path.dirname(__file__)), 'fixtures')
|
||||
FILE_PATH = path.join(FIXTURES_ROOT, 'test.txt')
|
||||
JSON_FILE_PATH = path.join(FIXTURES_ROOT, 'test.json')
|
||||
BIN_FILE_PATH = path.join(FIXTURES_ROOT, 'test.bin')
|
||||
|
||||
|
||||
FILE_PATH_ARG = patharg(FILE_PATH)
|
||||
@ -37,3 +38,4 @@ with open(BIN_FILE_PATH, 'rb') as f:
|
||||
BIN_FILE_CONTENT = f.read()
|
||||
|
||||
UNICODE = FILE_CONTENT
|
||||
|
@ -2,7 +2,7 @@
|
||||
import requests
|
||||
import pytest
|
||||
|
||||
from tests import http, httpbin, HTTP_OK
|
||||
from utils import http, httpbin, HTTP_OK
|
||||
import httpie.input
|
||||
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
"""Tests for dealing with binary request and response data."""
|
||||
from httpie.compat import urlopen
|
||||
from httpie.output.streams import BINARY_SUPPRESSED_NOTICE
|
||||
from tests import TestEnvironment, http, httpbin
|
||||
from tests.fixtures import BIN_FILE_PATH, BIN_FILE_CONTENT, BIN_FILE_PATH_ARG
|
||||
from utils import TestEnvironment, http, httpbin
|
||||
from fixtures import BIN_FILE_PATH, BIN_FILE_CONTENT, BIN_FILE_PATH_ARG
|
||||
|
||||
|
||||
class TestBinaryRequestData:
|
||||
|
@ -9,8 +9,8 @@ from httpie import input
|
||||
from httpie.input import KeyValue, KeyValueArgType
|
||||
from httpie import ExitStatus
|
||||
from httpie.cli import parser
|
||||
from tests import TestEnvironment, http, httpbin, HTTP_OK
|
||||
from tests.fixtures import (
|
||||
from utils import TestEnvironment, http, httpbin, HTTP_OK
|
||||
from fixtures import (
|
||||
FILE_PATH_ARG, JSON_FILE_PATH_ARG,
|
||||
JSON_FILE_CONTENT, FILE_CONTENT, FILE_PATH
|
||||
)
|
||||
|
@ -2,8 +2,8 @@
|
||||
Tests for the provided defaults regarding HTTP method, and --json vs. --form.
|
||||
|
||||
"""
|
||||
from tests import TestEnvironment, http, httpbin, HTTP_OK
|
||||
from tests.fixtures import FILE_PATH
|
||||
from utils import TestEnvironment, http, httpbin, HTTP_OK
|
||||
from fixtures import FILE_PATH
|
||||
|
||||
|
||||
class TestImplicitHTTPMethod:
|
||||
|
@ -4,7 +4,7 @@ import subprocess
|
||||
|
||||
import pytest
|
||||
|
||||
from tests import TESTS_ROOT
|
||||
from utils import TESTS_ROOT
|
||||
|
||||
|
||||
def has_docutils():
|
||||
|
@ -9,7 +9,7 @@ from httpie.downloads import (
|
||||
parse_content_range, filename_from_content_disposition, filename_from_url,
|
||||
get_unique_filename, ContentRangeError, Download,
|
||||
)
|
||||
from tests import httpbin, http, TestEnvironment
|
||||
from utils import httpbin, http, TestEnvironment
|
||||
|
||||
|
||||
class Response(object):
|
||||
|
@ -2,7 +2,7 @@ import requests
|
||||
import pytest
|
||||
|
||||
from httpie import ExitStatus
|
||||
from tests import TestEnvironment, http, httpbin, HTTP_OK
|
||||
from utils import TestEnvironment, http, httpbin, HTTP_OK
|
||||
|
||||
|
||||
class TestExitStatus:
|
||||
|
@ -1,6 +1,6 @@
|
||||
"""High-level tests."""
|
||||
from tests import TestEnvironment, http, httpbin, HTTP_OK
|
||||
from tests.fixtures import FILE_PATH, FILE_CONTENT
|
||||
from utils import TestEnvironment, http, httpbin, HTTP_OK
|
||||
from fixtures import FILE_PATH, FILE_CONTENT
|
||||
import httpie
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@ import pytest
|
||||
|
||||
from httpie import ExitStatus
|
||||
from httpie.output.processors.colors import get_lexer
|
||||
from tests import TestEnvironment, http, httpbin, HTTP_OK, COLOR, CRLF
|
||||
from utils import TestEnvironment, http, httpbin, HTTP_OK, COLOR, CRLF
|
||||
|
||||
|
||||
|
||||
|
@ -3,8 +3,8 @@ import os
|
||||
import shutil
|
||||
|
||||
from httpie.plugins.builtin import HTTPBasicAuth
|
||||
from tests import TestEnvironment, mk_config_dir, http, httpbin, HTTP_OK
|
||||
from tests.fixtures import UNICODE
|
||||
from utils import TestEnvironment, mk_config_dir, http, httpbin, HTTP_OK
|
||||
from fixtures import UNICODE
|
||||
|
||||
|
||||
class SessionTestBase(object):
|
||||
|
@ -2,8 +2,8 @@ import pytest
|
||||
|
||||
from httpie.compat import is_windows
|
||||
from httpie.output.streams import BINARY_SUPPRESSED_NOTICE
|
||||
from tests import http, httpbin, TestEnvironment
|
||||
from tests.fixtures import BIN_FILE_CONTENT, BIN_FILE_PATH
|
||||
from utils import http, httpbin, TestEnvironment
|
||||
from fixtures import BIN_FILE_CONTENT, BIN_FILE_PATH
|
||||
|
||||
|
||||
class TestStream:
|
||||
|
@ -3,8 +3,8 @@
|
||||
Various unicode handling related tests.
|
||||
|
||||
"""
|
||||
from tests import http, httpbin, HTTP_OK
|
||||
from tests.fixtures import UNICODE
|
||||
from utils import http, httpbin, HTTP_OK
|
||||
from fixtures import UNICODE
|
||||
|
||||
|
||||
class TestUnicode:
|
||||
|
@ -3,8 +3,8 @@ import os
|
||||
import pytest
|
||||
|
||||
from httpie.input import ParseError
|
||||
from tests import TestEnvironment, http, httpbin, HTTP_OK
|
||||
from tests.fixtures import FILE_PATH_ARG, FILE_PATH, FILE_CONTENT
|
||||
from utils import TestEnvironment, http, httpbin, HTTP_OK
|
||||
from fixtures import FILE_PATH_ARG, FILE_PATH, FILE_CONTENT
|
||||
|
||||
|
||||
class TestMultipartFormDataFileUpload:
|
||||
|
@ -4,7 +4,7 @@ import tempfile
|
||||
import pytest
|
||||
from httpie.context import Environment
|
||||
|
||||
from tests import TestEnvironment, http, httpbin
|
||||
from utils import TestEnvironment, http, httpbin
|
||||
from httpie.compat import is_windows
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user