-
Notifications
You must be signed in to change notification settings - Fork 3
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
Convert to temple #50
Conversation
multigl
commented
Aug 20, 2018
•
edited
Loading
edited
- Temple
- Circle CI 2.0
@@ -0,0 +1,9 @@ | |||
_extensions: [jinja2_time.TimeExtension] | |||
_template: git@github.com:CloverHealth/temple-python-public.git |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
You'll need to add installation of Postgres to the test setup (it's not part of the template), you can see an example here: https://github.com/CloverHealth/pgmock/blob/5c0d2be637c23729a306c0346b9ec1340450a54b/.circleci/config.yml#L17-L22. |
checks_and_deploy: | ||
jobs: | ||
- temple_check | ||
- lint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- test_py34
is missing here, which causes deploy
's requirements to fail below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or if this isn't Python 3.4 compatible, delete that job.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that seems to have done it
@@ -316,17 +317,16 @@ def test_disallow_flushes_within_clock_ticks_when_strict(self, session, session_ | |||
t.prop_a = 2 | |||
|
|||
with pytest.raises(AssertionError) as excinfo: | |||
eval('session.{func_name}()'.format(func_name=session_func_name)) | |||
eval('session.{func_name}()'.format(func_name=session_func_name)) # pylint: disable=eval-used |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of using eval
and string interpolation, could we use getattr(session, session_fun_name)()
? Here and throughout.
@@ -0,0 +1,2 @@ | |||
CHANGES | |||
======= |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you going to add content here from the past 10 releases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I GUESS
pyenv install -s 3.4.4 | ||
|
||
# Set up the dev env and the environments for Tox | ||
pyenv local ${MODULE_NAME} 3.6.2 3.5.3 3.4.4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't pyenv local
restricted to a single local version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good question, this makefile comes from a temple public project, I think it's necessary for tox
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh hmm I missed this in my update to the template, testing on CircleCI doesn't use tox anymore (and nor would it locally unless we set that up again).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if I'd put that effort in, tox was really challenging to get set up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, probably worth updating this in the template to only install a recent Python version.
@@ -63,13 +66,15 @@ def __init__( | |||
|
|||
@property | |||
def clock_table(self): | |||
""" DEPRECATED: use .clock_model instead -- Clock Model for this Model""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion (for later if necessary): Consider using decorators or direct warnings for deprecated functionality:
https://docs.python.org/3/library/warnings.html#warnings.warn
https://stackoverflow.com/questions/2536307/decorators-in-the-python-standard-lib-deprecated-specifically
I prefer these because pylint
picks them up and shows me them immediately in my IDE so I know to avoid using them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pycharm picks up the warnings.warn
on the next line about deprecation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Woops... I missed that line. Thanks!
|
||
assert re.match( | ||
r'.*flush\(\) has triggered for a changed temporalized property outside of a clock tick.*', | ||
str(excinfo) | ||
str(excinfo), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: I usually use str(excinfo.value)
to get only the exception class rather than the pytest
ExceptionInfo
wrapper which sometimes doesn't include the specific message.
pytest-mock==1.10.0 | ||
pytest==3.7.2 | ||
pytest-randomly>=1.0,<2 | ||
testing.postgresql>=1.3.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
YAAAAAS... so much prefer the disposable database approach of testing.postgres
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
me too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM