From 5f0c0fbb0adb45407008d84dc1b6e843cd94870c Mon Sep 17 00:00:00 2001 From: mathieui Date: Sun, 21 Aug 2016 15:39:46 +0200 Subject: Update tests --- .travis.yml | 4 +++- test/test_common.py | 15 ++++++--------- test/test_completion.py | 7 ++----- test/test_config.py | 5 +---- test/test_poopt.py | 4 +--- test/test_theming.py | 4 +--- test/test_windows.py | 8 +++----- test/test_xhtml.py | 4 +--- 8 files changed, 18 insertions(+), 33 deletions(-) diff --git a/.travis.yml b/.travis.yml index 28bf3dd3..7b5cb49f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,9 @@ language: python python: - - "3.4" + - "3.5" install: - pip install -r requirements.txt - python setup.py build_ext --inplace + - python setup.py install script: make test + diff --git a/test/test_common.py b/test/test_common.py index dde49524..d7bc2b8b 100644 --- a/test/test_common.py +++ b/test/test_common.py @@ -2,19 +2,16 @@ Test the functions in the `common` module """ -import sys -sys.path.append('poezio') - import time import pytest import datetime from slixmpp import JID from datetime import timedelta -from common import (_datetime_tuple as datetime_tuple, get_utc_time, - get_local_time, shell_split, _find_argument_quoted - as find_argument_quoted, _find_argument_unquoted as - find_argument_unquoted, parse_str_to_secs, - parse_secs_to_str, safeJID) +from poezio.common import (_datetime_tuple as datetime_tuple, get_utc_time, + get_local_time, shell_split, _find_argument_quoted + as find_argument_quoted, _find_argument_unquoted as + find_argument_unquoted, parse_str_to_secs, + parse_secs_to_str, safeJID) def test_utc_time(): delta = timedelta(seconds=-3600) @@ -65,4 +62,4 @@ def test_parse_secs_to_str(): def test_safeJID(): assert safeJID('toto@titi/tata') == JID('toto@titi/tata') - assert safeJID('é_è') == JID('') + assert safeJID('toto@…') == JID('') diff --git a/test/test_completion.py b/test/test_completion.py index 54c0f057..c731e807 100644 --- a/test/test_completion.py +++ b/test/test_completion.py @@ -5,19 +5,16 @@ Test the completions methods on an altered input object. import string import pytest import random -import sys import os -sys.path.append('poezio') - class ConfigShim(object): def get(self, *args, **kwargs): return '' -import config +from poezio import config config.config = ConfigShim() -from windows import Input +from poezio.windows import Input @pytest.fixture(scope="function") def input_obj(): diff --git a/test/test_config.py b/test/test_config.py index 4c87458e..d2f952de 100644 --- a/test/test_config.py +++ b/test/test_config.py @@ -4,13 +4,10 @@ Test the config module import tempfile import pytest -import sys import os -sys.path.append('poezio') - -import config +from poezio import config @pytest.yield_fixture(scope="module") def config_obj(): diff --git a/test/test_poopt.py b/test/test_poopt.py index 54f466a6..cdf8d041 100644 --- a/test/test_poopt.py +++ b/test/test_poopt.py @@ -3,10 +3,8 @@ Test of the poopt module """ import pytest -import sys -sys.path.append('poezio') -from poopt import cut_text +from poezio.poopt import cut_text def test_cut_text(): diff --git a/test/test_theming.py b/test/test_theming.py index 40d1ab42..08856571 100644 --- a/test/test_theming.py +++ b/test/test_theming.py @@ -2,11 +2,9 @@ Test the functions in the `theming` module """ -import sys import pytest -sys.path.append('poezio') -from theming import dump_tuple, read_tuple +from poezio.theming import dump_tuple, read_tuple def test_read_tuple(): assert read_tuple('1,-1,u') == ((1, -1), 'u') diff --git a/test/test_windows.py b/test/test_windows.py index 26a426c7..8623342b 100644 --- a/test/test_windows.py +++ b/test/test_windows.py @@ -1,16 +1,14 @@ import pytest -import sys -sys.path.append('poezio') class ConfigShim(object): def get(self, *args, **kwargs): return '' -import config +from poezio import config config.config = ConfigShim() -import core +from poezio import core -from windows import Input, HistoryInput, MessageInput, CommandInput +from poezio.windows import Input, HistoryInput, MessageInput, CommandInput @pytest.fixture def input(): diff --git a/test/test_xhtml.py b/test/test_xhtml.py index b4d6c3da..ad72513a 100644 --- a/test/test_xhtml.py +++ b/test/test_xhtml.py @@ -3,11 +3,9 @@ Test the functions in the `xhtml` module """ import pytest -import sys import xml -sys.path.append('poezio') -from xhtml import (poezio_colors_to_html, xhtml_to_poezio_colors, +from poezio.xhtml import (poezio_colors_to_html, xhtml_to_poezio_colors, parse_css, clean_text) def test_clean_text(): -- cgit v1.2.3