Skip to content

Commit

Permalink
chg: dev: revert GetHandler changes, use pytest.skip on py 36
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen L Arnold <nerdboy@gentoo.org>
  • Loading branch information
sarnold committed Oct 17, 2022
1 parent 6b5274f commit 64fd99b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 2 additions & 3 deletions pyserv/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"""

import logging
import os
import threading
from functools import partial
from http.server import HTTPServer, SimpleHTTPRequestHandler
from socketserver import ThreadingMixIn
from urllib.parse import urlparse
Expand Down Expand Up @@ -88,12 +88,11 @@ def __init__(self, iface, port, directory):
self.iface = iface
self.port = int(port)
self.directory = directory
self.handler = GetHandler
self.handler = partial(GetHandler, directory=self.directory)
self.server = ThreadingHTTPServer((self.iface, self.port), self.handler)

def run(self):
"""Start main server thread"""
os.chdir(self.directory)
self.server.serve_forever()

def stop(self):
Expand Down
4 changes: 3 additions & 1 deletion tests/test_handler.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# -*- coding: utf-8 -*-
import pathlib
import sys
import unittest
import urllib.request

import httptest
import pytest

from pyserv import GetHandler

FILE_PATH = pathlib.Path(__file__)

@pytest.mark.skipif(sys.version_info < (3, 7), reason="requires python3.7 or higher")
class TestHTTPTestMethods(unittest.TestCase):

@httptest.Server(
Expand Down

0 comments on commit 64fd99b

Please sign in to comment.