Skip to content

Commit 6cefc21

Browse files
committed
Add version tests
1 parent a9bf50a commit 6cefc21

File tree

4 files changed

+60
-4
lines changed

4 files changed

+60
-4
lines changed

ci/test.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
3+
python3 -m unittest discover -s ../
Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,49 @@
1+
import os
12
from pathlib import Path
23

3-
BOT_PROJECT_NAME = 'TEST_ALGORITHM'
4+
BOT_PROJECT_NAME = 'bot'
45

5-
BASE_DIR = str(Path(__file__).parent)
6+
BOT_CONTEXT_CONFIGURATION = 'bot.configuration.context'
67

7-
INSTALLED_DATA_PROVIDER_APPS = []
8+
# Change this when not in development, feature or hot-fix branch
9+
DEBUG = int(os.environ.get('DEBUG', True))
810

9-
INSTALLED_STRATEGY_APPS = []
11+
BASE_DIR = str(Path(__file__).parent.parent)
1012

13+
LOG_FILE_NAME = 'log'
14+
15+
LOG_DIR = '{}/logs'.format(BASE_DIR)
16+
17+
LOG_PATH = "{}/{}.log".format(LOG_DIR, LOG_FILE_NAME)
18+
19+
# if not os.path.isdir(LOG_DIR):
20+
# os.mkdir(LOG_DIR)
21+
22+
if DEBUG:
23+
logging_level = "DEBUG"
24+
else:
25+
logging_level = "INFO"
26+
27+
# Logging configuration
28+
LOGGING = {
29+
'version': 1,
30+
'disable_existing_loggers': False,
31+
'formatters': {
32+
'standard': {
33+
'format': '%(levelname)s %(asctime)s - [thread: %(threadName)-4s %(name)s] %(message)s',
34+
'datefmt': '%Y-%m-%d %H:%M:%S'
35+
}
36+
},
37+
'handlers': {
38+
'console': {
39+
'class': 'logging.StreamHandler',
40+
'formatter': 'standard',
41+
},
42+
},
43+
'loggers': {
44+
'': {
45+
'level': logging_level,
46+
'handlers': ['console'],
47+
},
48+
},
49+
}

investing_bot_framework/tests/utils/__init__.py

Whitespace-only changes.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from unittest import TestCase
2+
from investing_bot_framework.utils.version import get_version, get_complete_version, get_main_version
3+
4+
5+
class Version(TestCase):
6+
7+
def test(self):
8+
self.assertIsNotNone(get_version())
9+
self.assertEqual(type(get_version()), str)
10+
11+
version = (1, 0, 0, 'alpha', 0)
12+
self.assertEqual(get_version(version), '1.0')
13+
self.assertEqual(get_main_version(version), '1.0')
14+
self.assertEqual(get_complete_version(version), version)

0 commit comments

Comments
 (0)