Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TST: Move off nose and on to pytest #179

Merged
merged 5 commits into from
Oct 13, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ jobs:
- name: Lint with flake8
run: |
flake8
- name: Test with nose
- name: Test with pytest
run: |
nosetests tests
pytest tests
5 changes: 2 additions & 3 deletions etc/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
configparser==3.5.0
enum34==1.1.6
flake8==3.7.9
nose==1.3.7
nose-ignore-docstring==0.2
nose-timer==0.7.5
pytest==4.6.11;python_version<"3.5"
pytest==6.0.1;python_version>"2.7"
gerrymanoim marked this conversation as resolved.
Show resolved Hide resolved
parameterized==0.6.1
python-dateutil==2.7.3
pytz==2019.3
Expand Down
10 changes: 0 additions & 10 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
[nosetests]
verbosity=2
gerrymanoim marked this conversation as resolved.
Show resolved Hide resolved
detailed-errors=1
with-ignore-docstrings=1
with-timer=1
gerrymanoim marked this conversation as resolved.
Show resolved Hide resolved
timer-top-n=15
cover-package=trading_calendars
gerrymanoim marked this conversation as resolved.
Show resolved Hide resolved
logging-level=INFO
traverse-namespace=1

[metadata]
description-file = README.md
license_file = LICENSE
Expand Down
4 changes: 1 addition & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,7 @@
extras_require={
"test": [
"flake8",
"nose",
"nose-ignore-docstring",
"nose-timer",
"pytest",
"parameterized",
],
},
Expand Down
8 changes: 4 additions & 4 deletions tests/test_calendar_dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
class CalendarAliasTestCase(TestCase):

@classmethod
def setupClass(cls):
def setup_class(cls):
gerrymanoim marked this conversation as resolved.
Show resolved Hide resolved
# Make a calendar once so that we don't spend time in every test
# instantiating calendars.
cls.dispatcher_kwargs = dict(
Expand All @@ -26,18 +26,18 @@ def setupClass(cls):
},
)

def setUp(self):
def setup_method(self, method):
self.dispatcher = TradingCalendarDispatcher(
# Make copies here so that tests that mutate the dispatcher dicts
# are isolated from one another.
**{k: v.copy() for k, v in self.dispatcher_kwargs.items()}
)

def tearDown(self):
def teardown_method(self, method):
self.dispatcher = None

@classmethod
def tearDownClass(cls):
def teardown_class(cls):
cls.dispatcher_kwargs = None

def test_follow_alias_chain(self):
Expand Down
10 changes: 5 additions & 5 deletions tests/test_trading_calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

import numpy as np
import pandas as pd
from nose_parameterized import parameterized
from parameterized import parameterized
from pandas import read_csv
from pandas import Timedelta
from pandas.util.testing import assert_index_equal
Expand Down Expand Up @@ -61,11 +61,11 @@ class FakeCalendar(TradingCalendar):


class CalendarRegistrationTestCase(TestCase):
def setUp(self):
def setup_method(self, method):
self.dummy_cal_type = FakeCalendar
self.dispatcher = TradingCalendarDispatcher({}, {}, {})

def tearDown(self):
def teardown_method(self, method):
self.dispatcher.clear_calendars()

def test_register_calendar(self):
Expand Down Expand Up @@ -229,7 +229,7 @@ def load_answer_key(filename):
)

@classmethod
def setupClass(cls):
def setup_class(cls):
cls.answers = cls.load_answer_key(cls.answer_key_filename)

cls.start_date = cls.answers.index[0]
Expand All @@ -240,7 +240,7 @@ def setupClass(cls):
cls.one_hour = pd.Timedelta(hours=1)

@classmethod
def teardownClass(cls):
def teardown_class(cls):
cls.calendar = None
cls.answers = None

Expand Down
2 changes: 1 addition & 1 deletion tests/test_xidx_calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pandas as pd
from pytz import UTC
from nose_parameterized import parameterized
from parameterized import parameterized

from .test_trading_calendar import NoDSTExchangeCalendarTestBase
from trading_calendars.trading_calendar import WEEKENDS
Expand Down
2 changes: 1 addition & 1 deletion tests/test_xjse_calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pandas as pd
from pytz import UTC
from nose_parameterized import parameterized
from parameterized import parameterized

from .test_trading_calendar import NoDSTExchangeCalendarTestBase
from trading_calendars.trading_calendar import WEEKENDS
Expand Down
2 changes: 1 addition & 1 deletion tests/test_xkar_calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import pandas as pd
from pytz import UTC
from nose_parameterized import parameterized
from parameterized import parameterized

from .test_trading_calendar import NoDSTExchangeCalendarTestBase
from trading_calendars.trading_calendar import WEEKENDS
Expand Down