Просмотр исходного кода

changed travis configuration to get py.test to work

pull/147/head
Johannes 8 лет назад
Родитель
Сommit
82d685d13c
3 измененных файлов: 18 добавлений и 7 удалений
  1. +5
    -7
      tests/logs/test_log_view.py
  2. +0
    -0
      tests/testlib/__init__.py
  3. +13
    -0
      tests/testlib/utils.py

+ 5
- 7
tests/logs/test_log_view.py Просмотреть файл

@@ -1,15 +1,13 @@

from modules.logs import LogView
from tests.testlib import utils


class TestLogView(object):

def test_get_all_logfiles(self):
LogView._log_directory = utils.get_base_path() + "/logs"

LogView._log_directory = "./logs"

log_view = LogView()
logfiles = log_view.get_all_logfiles()
logfiles = LogView().get_all_logfiles()

print(logfiles)
assert (len(logfiles) == 2)
# if no log file is found then two square brackets "[]" are returned and string length is 2
assert (len(logfiles) > 2)

+ 0
- 0
tests/testlib/__init__.py Просмотреть файл


+ 13
- 0
tests/testlib/utils.py Просмотреть файл

@@ -0,0 +1,13 @@
import os


def get_base_path():
marker_file = "run.py"

current_path = os.getcwd()

while current_path != 0:
if marker_file in os.listdir(current_path):
return current_path

current_path = os.path.dirname(os.path.normpath(current_path))

Загрузка…
Отмена
Сохранить