Skip to content

Commit 7f85fe6

Browse files
committed
Adding CLI Capabilities
🐛 Trying to fix failing tests on TravisCI. Working on #3
1 parent d0d94da commit 7f85fe6

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ script:
1010
- make test
1111
after_success:
1212
- coveralls
13+
after_failure:
14+
-
1315
before_script:
1416
- psql -f dbscripts/postgresql_account_create.sql -U postgres
1517
- psql -f dbscripts/postgresql_process_tracker.sql process_tracking -U postgres

tests/test_cli.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,14 @@
1414

1515
class TestCli(unittest.TestCase):
1616

17-
def setUp(self):
17+
@classmethod
18+
def setUpClass(cls):
19+
20+
cls.data_store = DataStore()
21+
cls.session = cls.data_store.session
1822

23+
def setUp(self):
1924
self.runner = CliRunner()
20-
self.session = DataStore().session
2125

2226
# def test_setup(self):
2327
#
@@ -145,12 +149,10 @@ def test_delete_actor(self):
145149
:return:
146150
"""
147151
self.runner.invoke(process_tracker.cli.main, 'create -t actor -n "Test Test"')
148-
instance = self.session.query(Actor).filter(Actor.actor_name == 'Test Test').first()
149-
print(instance.actor_name)
150152
result = self.runner.invoke(process_tracker.cli.main, 'delete -t actor -n "Test Test"')
151153

152154
instance = self.session.query(Actor).filter(Actor.actor_name == 'Test Test').first()
153-
155+
print(result.output)
154156
self.assertEqual(None, instance)
155157
self.assertEqual(0, result.exit_code)
156158

tests/test_process_tracker.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Tests for validating process_tracking works as expected.
22

33
from datetime import datetime, timedelta
4+
import time
45
import unittest
56
from unittest.mock import patch
67

@@ -261,6 +262,8 @@ def test_find_ready_extracts_by_process_not_descending(self):
261262
, location_name='Test Location'
262263
, location_path='/home/test/extract_dir')
263264

265+
time.sleep(3)
266+
264267
extract2 = ExtractTracker(process_run=self.process_tracker
265268
, filename='test_extract_filename5-2.csv'
266269
, location_name='Test Location'
@@ -272,6 +275,7 @@ def test_find_ready_extracts_by_process_not_descending(self):
272275
session.commit()
273276

274277
extract2.extract.extract_status_id = extract2.extract_status_ready
278+
extract2.extract.extract_registration_date_time = datetime.now() # Records were being committed too close together.
275279
session = Session.object_session(extract2.extract)
276280
session.commit()
277281

0 commit comments

Comments
 (0)