-
-
Notifications
You must be signed in to change notification settings - Fork 525
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 autoreload #5490
Fix autoreload #5490
Conversation
Codecov Report
@@ Coverage Diff @@
## main #5490 +/- ##
===========================================
- Coverage 83.29% 72.27% -11.03%
===========================================
Files 275 276 +1
Lines 40124 40135 +11
===========================================
- Hits 33423 29006 -4417
- Misses 6701 11129 +4428
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 85 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Is it possible to test this? Breaking |
I quickly tried to do something with
Yep, and it is all PeriodicCallback, which does not have a |
Yes, let's release 1.2.3 asap. Definitely need a test here. |
I have been trying to get a test to run with the following, which works fine if I use something like: import os
import pytest
import time
from panel.tests.util import (
run_panel_serve, unix_only, wait_for_port, write_file
)
try:
from playwright.sync_api import expect
pytestmark = pytest.mark.ui
except ImportError:
pytestmark = pytest.mark.skip('playwright not available')
@unix_only
def test_autoreload_app(py_file, port, page):
app = "import panel as pn; pn.Row('Example 1').servable()"
app2 = "import panel as pn; pn.Row('Example 2').servable()"
write_file(app, py_file.file)
app_name = os.path.basename(py_file.name)[:-3]
with run_panel_serve(["--port", str(port), '--autoreload', py_file.name]) as p:
port = wait_for_port(p.stdout)
time.sleep(0.2)
page.goto(f"http://localhost:{port}/{app_name}")
expect(page.locator(".markdown")).to_have_text("Example 1")
write_file(app2, py_file.file)
expect(page.locator(".markdown")).to_have_text('Example 2') |
Can you add the test to the PR, then I'll iterate. |
Done. I want to note we can't use |
Added a timeout, which isn't elegant but should work. The problem here is that I guess is that the file is changed before the websocket is fully open, which means it never receives the event. Wonder if maybe we should put a |
I feel like I tried all combinations of Thank you for the solution 👍 |
If this passes I'll merge as is, because the .hold() + .unhold() thing seems like a good idea but has the potential to break a ton of stuff, so should be tackled separately. |
Fixes #5489
self.count
has a default of None (meaning unlimited), which will always give an exception out when comparing toself.counter