1
0
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:
Jakub Roztocil 2014-04-28 11:29:41 +02:00
parent faec00fd99
commit 2aa53e4be3
16 changed files with 29 additions and 27 deletions

View File

@ -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

View File

@ -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

View File

@ -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:

View File

@ -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
)

View File

@ -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:

View File

@ -4,7 +4,7 @@ import subprocess
import pytest
from tests import TESTS_ROOT
from utils import TESTS_ROOT
def has_docutils():

View File

@ -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):

View File

@ -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:

View File

@ -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

View File

@ -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

View File

@ -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):

View File

@ -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:

View File

@ -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:

View File

@ -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:

View File

@ -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