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

Fix the auto_reloader to work when the executable was launched with a module #1501

Merged
merged 1 commit into from
Mar 3, 2019

Conversation

ashleysommer
Copy link
Member

Fixes #1492
Implements a detection routine when determining arguments for launching the child application, it checks if the executable was launched as a module, rather than a script, and if so launch the same module with the -m commandline argument again.

This PR also includes a different auto_reloader script, which passes the current cwd to the subprocess.call() call.

This is a basic workaround to get bugs in the current auto_reloader fixed for the 2019.03 sanic release.
We do intend to replace this simple naive auto_reloader in the future to be more robust one, that will potentially be implemented as a plugin.

@ashleysommer
Copy link
Member Author

ashleysommer commented Mar 1, 2019

Can anyone work out what is causing the failure in the py35-no-ext test in travis?
The failure is in logging tests and is not related to this PR.
It seems that for some reason in py35 with no uvloop, the asyncio module is emitting a message to the caplog causing the caplog contents check to fail its assertion.

EDIT: I ran it again, with no modifications, it passed this time.

@codecov
Copy link

codecov bot commented Mar 1, 2019

Codecov Report

Merging #1501 into master will decrease coverage by 0.36%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #1501      +/-   ##
=========================================
- Coverage   91.46%   91.1%   -0.37%     
=========================================
  Files          17      17              
  Lines        1735    1742       +7     
  Branches      331     333       +2     
=========================================
  Hits         1587    1587              
- Misses        123     130       +7     
  Partials       25      25
Impacted Files Coverage Δ
sanic/reloader_helpers.py 14.73% <0%> (-1.18%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 34fe26e...3c01a2d. Read the comment docs.

@ashleysommer
Copy link
Member Author

Codecov Diff is negative because there are no tests that touch the auto_reloader. So any modifications to the auto_reloader that add additional lines will decrease codecov further.

Copy link
Contributor

@sjsadowski sjsadowski left a comment

Choose a reason for hiding this comment

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

Added #1504 as a follow-up to this (hopefully for 19.6)

@sjsadowski sjsadowski merged commit 4260528 into sanic-org:master Mar 3, 2019
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.

Module import fails when auto_reload is active
2 participants