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

Clean up unittest deprecations and warnings #2130

Merged
merged 12 commits into from
Jul 3, 2017
Merged

Conversation

xoob
Copy link
Contributor

@xoob xoob commented May 25, 2017

This PR cleans up a number of warnings and notices in the tests. Detailed descriptions are in the commit messages.

Motivation and Context

Needed to get aquatinted with the test infrastructure. Aside from that, general maintenance and keeping things neat.

Have you tested this? If so, how?

Tested locally with tox -e py36-nonhdfs and tox -e py27-nonhdfs.

xoob added 8 commits May 25, 2017 20:19
Fixes getpcmd on macOS by calling 'pgrep' instead of reading '/proc',
which is not available. This fixes two failures in lock_test.

Also fixes an issue where UTF-8 process could not be hashed in
Python 2.6.
Fixes "DeprecationWarning: Please use assertEqual instead."
Fixes noisy warnings during tests by using assertWarns() added
in Python 3.
Fixes a number of deprecation warnings regarding configuration:

test_config_summary_limit (execution_summary_test.ExecutionSummaryTest) ...
    DeprecationWarning: Configuration [execution_summary] summary_length (with dashes) should be avoided. Please use underscores.

test_disable_emails (worker_test.WorkerEmailTest) ...
    DeprecationWarning: The use of the configuration [core] email-type is deprecated. Please use [email] format

test_task_limit_exceeded (worker_test.TaskLimitTest) ...
    DeprecationWarning: The use of the configuration [core] worker-task-limit is deprecated. Please use [worker] task_limit

test_complete_error (worker_test.WorkerEmailTest) ...
    DeprecationWarning: Configuration [email] force_send (with dashes) should be avoided. Please use underscores.

test_scheduler_with_config (scheduler_test.SchedulerIoTest) ...
    DeprecationWarning: Configuration [scheduler] worker_disconnect_delay (with dashes) should be avoided. Please use underscores.

test_sendgrid (notifications_test.TestNotificationDispatcher) ...
    DeprecationWarning: Configuration [email] force_send (with dashes) should be avoided. Please use underscores.
    DeprecationWarning: The use of the configuration [email] type is deprecated. Please use [email] method

Call notificaions.send_email_smtp with fixture parameters with smtp_without_tls  set to False ...
    DeprecationWarning: The use of the configuration [core] smtp_host is deprecated. Please use [smtp] host
    DeprecationWarning: The use of the configuration [core] smtp_local_hostname is deprecated. Please use [smtp] local_hostname
    ...

Call notificaions.send_email_sendgrid with fixture parameters ...
    DeprecationWarning: The use of the configuration [email] SENDGRID_USERNAME is deprecated. Please use [sendgrid] username
    DeprecationWarning: The use of the configuration [email] SENDGRID_PASSWORD is deprecated. Please use [sendgrid] password
@mention-bot
Copy link

@xoob, thanks for your PR! By analyzing the history of the files in this pull request, we identified @Tarrasch, @erikbern and @daveFNbuck to be potential reviewers.

else:
cmd_hash = my_cmd

cmd_hash = my_cmd.encode('utf8')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, now this causes breakage on Linux, py27: UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 4: ordinal not in range(128).

Would this change to line 52 be appropriate?

-return fh.read().replace('\0', ' ').rstrip()
+return fh.read().replace('\0', ' ').decode('utf8').rstrip()

@Tarrasch
Copy link
Contributor

Thank you so much!!!

Can you just fix the flake8 error? (also check why py27 fails)

@Tarrasch
Copy link
Contributor

@xoob, this is a really good PR which I would like to merge, can you just fix the flake8 error?

@xoob
Copy link
Contributor Author

xoob commented Jun 30, 2017 via email

@erikbern
Copy link
Contributor

erikbern commented Jul 1, 2017

looks awesome!

@xoob
Copy link
Contributor Author

xoob commented Jul 3, 2017

@Tarrasch @erikbern All tests and flake8 now pass.

Unrelated to the changes in this PR, the py27-cdh and py36-cdh suites time out after 50 minutes. This seems to happen on master too.

@Tarrasch Tarrasch merged commit 24dfe0f into spotify:master Jul 3, 2017
@Tarrasch
Copy link
Contributor

Tarrasch commented Jul 3, 2017

The commit message quality was quite mixed, but overall I thought it might be useful to keep the whole commit history as some commits were particularly useful to be able to introspect in isolation. So did a rebase-merge here. :)

Thanks a lot for this contribution. This greatly increases the code quality in luigi!

@xoob
Copy link
Contributor Author

xoob commented Jul 3, 2017

@Tarrasch Which commit messages worked for you and how would you improve the other ones?

@Tarrasch
Copy link
Contributor

Tarrasch commented Jul 3, 2017

@xoob good question! These are my opinion and they are by no means better than anyone else's:

  • I really liked the first one. As it has a clear description and useful details in the body
  • Actually I definitely liked most of your commits
  • I found one to have >20 lines of text in body. Which might feel not so scroll friendly in some views, and I doubt anybody is going to read all that, and it is maybe obvious from the actual code change.
  • I prefer flake8 fixes to not be separate, but I do it myself too, because it's so hard to amend them in later.
  • The last 3 commits seem to say the same thing and should probably have been only 1 (unless I'm mistaken).

Are any of these thoughts useful as feedback? :)

@xoob
Copy link
Contributor Author

xoob commented Jul 3, 2017

@Tarrasch Very useful, thanks. I could have amended and force-pushed the last three commits (and possibly the flake8 changes too), which I'll do next time. Appreciate the feedback.

@Tarrasch
Copy link
Contributor

Tarrasch commented Jul 3, 2017

I could have amended and force-pushed the last three commits

Not everyone is so responsive to iterate on their commits. Thanks for your cooperation. ^^

@xoob xoob deleted the fix-tests branch July 3, 2017 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants