Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Replaceurllib3 withhttpx#333

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
scottwallacesh wants to merge9 commits intocdent:mainfromscottwallacesh:main
Closed
Show file tree
Hide file tree
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
fix tests and pep formatting, use py313 instead of py39
  • Loading branch information
@cdent
cdent committedMar 18, 2025
commite7ccd9bbfc3e2cb12ce45f4f07d18146305a21f7
12 changes: 6 additions & 6 deletions.github/workflows/tests.yaml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -37,12 +37,12 @@ jobs:
toxenv: py312-pytest
- python: "3.13"
toxenv: py313-pytest
- python:3.9
toxenv:py39-failskip
- python:3.9
toxenv:py39-limit
- python:3.9
toxenv:py39-prefix
- python:"3.13"
toxenv:py313-failskip
- python:"3.13"
toxenv:py313-limit
- python:"3.13"
toxenv:py313-prefix
name: ${{ matrix.toxenv }} on Python ${{ matrix.python }}
steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletiongabbi/driver.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -158,7 +158,7 @@ def build_tests(path, loader, host=None, port=8001, intercept=None,


def py_test_generator(test_dir, host=None, port=8001, intercept=None,
prefix=None, test_loader_name=None,
prefix='', test_loader_name=None,
fixture_module=None, response_handlers=None,
content_handlers=None, require_ssl=False, url=None,
metafunc=None, use_prior_test=True,
Expand Down
8 changes: 6 additions & 2 deletionsgabbi/httpclient.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -36,8 +36,12 @@ def __init__(self, **kwargs):
self.extensions['sni_hostname'] = kwargs['server_hostname']
transport = kwargs.get('intercept')
if transport:
transport = httpx.WSGITransport(app=transport(), script_name=kwargs.get('prefix'))
self.client = httpx.Client(transport=transport, verify=kwargs.get('cert_validate', True))
transport = httpx.WSGITransport(
app=transport(), script_name=kwargs.get("prefix", "")
)
self.client = httpx.Client(
transport=transport, verify=kwargs.get("cert_validate", True)
)

def request(self, absolute_uri, method, body, headers, redirect, timeout):
response = self.client.request(
Expand Down
20 changes: 19 additions & 1 deletiongabbi/tests/external_server.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,31 @@
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

import sys
from wsgiref import simple_server

from gabbi.tests import simple_wsgi


def run(port):
server = simple_server.make_server("127.0.0.1", int(port), simple_wsgi.SimpleWsgi())
server = simple_server.make_server(
"127.0.0.1",
int(port),
simple_wsgi.SimpleWsgi(),
)
server.serve_forever()


if __name__ == "__main__":
port = sys.argv[1]
run(port)
11 changes: 8 additions & 3 deletionsgabbi/tests/simple_wsgi.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -30,15 +30,20 @@ def __call__(self, environ, start_response):
global METHODS
global CURRENT_POLL

script_name = environ.get('SCRIPT_NAME', '')
path_info = environ.get('PATH_INFO', '').removeprefix(script_name)
request_method = environ['REQUEST_METHOD'].upper()
query_string = environ.get('QUERY_STRING', '')
query_data = urlparse.parse_qs(query_string)
request_url = environ.get('PATH_INFO', '')
path_info = environ.get('PATH_INFO', '')
request_url = script_name + path_info
accept_header = environ.get('HTTP_ACCEPT')
content_type_header = environ.get('CONTENT_TYPE', '')

full_request_url = self._fully_qualify(environ, request_url, query_string)
full_request_url = self._fully_qualify(
environ,
request_url,
query_string,
)

if accept_header and accept_header != '*/*':
response_content_type = accept_header
Expand Down
6 changes: 4 additions & 2 deletionsgabbi/tests/test_runner.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,8 +15,8 @@

from io import StringIO
import os
import subprocess
import socket
import subprocess
import sys
import time
import unittest
Expand All@@ -32,6 +32,7 @@ def get_free_port():
sock.bind(('', 0))
return sock.getsockname()[1]


class ForkedWSGIServer:

def __init__(self, port):
Expand All@@ -43,7 +44,8 @@ def start(self):
env=os.environ.update({"PYTHONPATH": "."}),
close_fds=True)
# We need to sleep a bit to let the wsgi server start.
time.sleep(.2)
# TODO(cdent): This is regrettable.
time.sleep(.4)

def stop(self):
self.process.terminate()
Expand Down
10 changes: 5 additions & 5 deletionstox.ini
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
[tox]
minversion = 3.1.1
skipsdist = True
envlist = pep8,py38,py39,py310,py311,py312,py313,pypy3,pep8,limit,failskip,docs,py39-prefix,py39-limit,py39-verbosity,py39-failskip,py36-pytest,py38-pytest,py39-pytest,py310-pytest,py311-pytest,py312-pytest,py313-pytest
envlist = pep8,py38,py39,py310,py311,py312,py313,pypy3,pep8,limit,failskip,docs,py313-prefix,py313-limit,py313-verbosity,py313-failskip,py36-pytest,py38-pytest,py39-pytest,py310-pytest,py311-pytest,py312-pytest,py313-pytest

[testenv]
deps = -r{toxinidir}/requirements.txt
Expand DownExpand Up@@ -40,7 +40,7 @@ commands = py.test gabbi
[testenv:py313-pytest]
commands = py.test {posargs} gabbi

[testenv:py39-prefix]
[testenv:py313-prefix]
setenv = GABBI_PREFIX=/snoopy

[testenv:pep8]
Expand All@@ -49,15 +49,15 @@ deps = hacking
commands =
flake8

[testenv:py39-limit]
[testenv:py313-limit]
allowlist_externals = {toxinidir}/test-limit.sh
commands = {toxinidir}/test-limit.sh

[testenv:py39-verbosity]
[testenv:py313-verbosity]
allowlist_externals = {toxinidir}/test-verbosity.sh
commands = {toxinidir}/test-verbosity.sh

[testenv:py39-failskip]
[testenv:py313-failskip]
allowlist_externals = {toxinidir}/test-failskip.sh
commands = {toxinidir}/test-failskip.sh

Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp