-
Notifications
You must be signed in to change notification settings - Fork 290
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add env var: MESOP_APP_BASE_PATH (#1057)
- Loading branch information
1 parent
4ea0053
commit 6aebbfd
Showing
13 changed files
with
83 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
load("//build_defs:defaults.bzl", "py_library") | ||
|
||
package( | ||
default_visibility = ["//build_defs:mesop_examples"], | ||
) | ||
|
||
py_library( | ||
name = "app_base", | ||
srcs = glob(["*.py"]), | ||
data = glob([ | ||
"static/**/*", | ||
]), | ||
deps = [ | ||
"//mesop", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from mesop.examples.app_base import main as main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import os | ||
|
||
import mesop as me | ||
|
||
|
||
@me.page(path="/examples/app_base") | ||
def page(): | ||
me.text( | ||
"Testing: MESOP_APP_BASE_PATH=" | ||
+ os.getenv("MESOP_APP_BASE_PATH", "<not set>") | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
test MESOP_APP_BASE_PATH works |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import {test, expect} from '@playwright/test'; | ||
|
||
test.describe('MESOP_APP_BASE_PATH', () => { | ||
if (process.env['MESOP_APP_BASE_PATH'] === undefined) { | ||
test.skip('Test skipped because MESOP_APP_BASE_PATH is not set.'); | ||
} | ||
test('serves static file relative to MESOP_APP_BASE_PATH', async ({page}) => { | ||
const response = await page.goto('/static/test.txt'); | ||
expect(response!.status()).toBe(200); | ||
const text = await response!.text(); | ||
expect(text).toContain('test MESOP_APP_BASE_PATH works'); | ||
}); | ||
}); |