mirror of
https://github.com/kernc/backtesting.py.git
synced 2024-01-28 15:29:30 +03:00
MNT: Make module backtesting.test runnable
This commit is contained in:
6
backtesting/test/__main__.py
Normal file
6
backtesting/test/__main__.py
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import unittest
|
||||||
|
|
||||||
|
suite = unittest.defaultTestLoader.discover('backtesting.test',
|
||||||
|
pattern='_test*.py')
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.TextTestRunner().run(suite)
|
||||||
@@ -500,6 +500,10 @@ class TestUtil(TestCase):
|
|||||||
self.assertEqual(_as_str(_Array([1], name=s)), s[0])
|
self.assertEqual(_as_str(_Array([1], name=s)), s[0])
|
||||||
|
|
||||||
|
|
||||||
|
@unittest.skipUnless(
|
||||||
|
os.path.isdir(os.path.join(os.path.dirname(__file__),
|
||||||
|
'..', '..', 'doc')),
|
||||||
|
"docs dir doesn't exist")
|
||||||
class TestDocs(TestCase):
|
class TestDocs(TestCase):
|
||||||
def test_examples(self):
|
def test_examples(self):
|
||||||
examples = glob(os.path.join(os.path.dirname(__file__),
|
examples = glob(os.path.join(os.path.dirname(__file__),
|
||||||
|
|||||||
9
setup.py
9
setup.py
@@ -5,13 +5,6 @@ if sys.version_info < (3, 4):
|
|||||||
sys.exit('ERROR: Backtesting.py requires Python 3.4+')
|
sys.exit('ERROR: Backtesting.py requires Python 3.4+')
|
||||||
|
|
||||||
|
|
||||||
def _discover_tests():
|
|
||||||
import unittest
|
|
||||||
return unittest.defaultTestLoader.discover('backtesting.test',
|
|
||||||
pattern='*test*.py',
|
|
||||||
top_level_dir='.')
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
from setuptools import setup, find_packages
|
from setuptools import setup, find_packages
|
||||||
|
|
||||||
@@ -52,7 +45,7 @@ if __name__ == '__main__':
|
|||||||
'flake8',
|
'flake8',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
test_suite="setup._discover_tests",
|
test_suite="backtesting.test",
|
||||||
python_requires='>=3.4',
|
python_requires='>=3.4',
|
||||||
author='Zach Lûster',
|
author='Zach Lûster',
|
||||||
classifiers=[
|
classifiers=[
|
||||||
|
|||||||
Reference in New Issue
Block a user