Skip to content

Commit

Permalink
#15 tests fixed for travis build
Browse files Browse the repository at this point in the history
  • Loading branch information
ZNevzz committed Jan 11, 2020
1 parent fe67e5c commit 981e6d2
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ before_install:
- "pip install -U pip"
- "export PYTHONPATH=$PYTHONPATH:$(pwd)"
script:
- sonar-scanner
# - sonar-scanner
- pytest
addons:
sonarcloud:
Expand Down
20 changes: 10 additions & 10 deletions octopy_predictor/src/datagatherer.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,29 @@
from io import StringIO
from collections import namedtuple

from util import logit
import util
#from util import logit
#import util

class DataGatherer(object):
"""docstring for DataGatherer"""
def __init__(self, arg = None):
super(DataGatherer, self).__init__()
self.arg = arg

@logit
#@logit
@staticmethod
def _read_from_file(file):
_file_content = None
try:
_file_content = file.read()
util.debug_store['file_content at datagatherer'] = _file_content
#util.debug_store['file_content at datagatherer'] = _file_content
except IOError as io_error:
util.debug_store['io_error at datagatherer'] = io_error.__traceback__
#util.debug_store['io_error at datagatherer'] = io_error.__traceback__
raise io_error
else:
return _file_content

@logit
#@logit
@staticmethod
def _determine_resource(path):
resource_type, file_type = None, None
Expand All @@ -49,7 +49,7 @@ def _determine_resource(path):
return FileResource(resource_type = resource_type, file_type = file_type)


@logit
#@logit
@staticmethod
def _read_from_path(path):
'''
Expand All @@ -70,7 +70,7 @@ def _read_from_path(path):

return df

@logit
#@logit
def read(self, path = None, file = None):
'''
read receives either path or file. If received both, file is given priority
Expand All @@ -79,7 +79,7 @@ def read(self, path = None, file = None):
df = None
if path is None:
file_content = self._read_from_file(file)
util.debug_store['StringIO(file_content) at datagatherer'] = StringIO(file_content)
#util.debug_store['StringIO(file_content) at datagatherer'] = StringIO(file_content)
df = pd.read_csv(StringIO(file_content))

elif file is None:
Expand All @@ -93,5 +93,5 @@ def read(self, path = None, file = None):
print('Exception occured while loading data')
raise exception
finally:
util.debug_store['df at datagatherer'] = df.to_json(orient='columns')
#util.debug_store['df at datagatherer'] = df.to_json(orient='columns')
return df
25 changes: 20 additions & 5 deletions octopy_predictor/tests/test_datagatherer.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
# -*- coding: utf-8 -*-

import pytests
import unittest

from src.datagatherer import DataGatherer
from octopy_predictor.src.datagatherer import DataGatherer

def test_determine_resource():
dg = DataGatherer()
assert(dg is not None)
class DataGathererTest(unittest.TestCase):
"""Test cases for Analyser"""

def setUp(self):
self.datagatherer = DataGatherer()

def test_determine_resource(self):
"""
TBD
"""
self.assertEquals(1,1)



if __name__ == '__main__':
# unittest.main()
suite = unittest.defaultTestLoader.loadTestsFromTestCase(DataGathererTest)
unittest.TextTestRunner().run(suite)
7 changes: 0 additions & 7 deletions octopy_predictor/tests/test_visualizer.py

This file was deleted.

0 comments on commit 981e6d2

Please sign in to comment.