mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
New --plugins-dir=plugins/ option (#212)
* New --plugins-dir=plugins/ option
New option causing Datasette to load and evaluate all of the Python files in
the specified directory and register any plugins that are defined in those
files.
This new option is available for the following commands:
datasette serve mydb.db --plugins-dir=plugins/
datasette publish now/heroku mydb.db --plugins-dir=plugins/
datasette package mydb.db --plugins-dir=plugins/
* Unit tests for --plugins-dir=plugins/
Closes #211
This commit is contained in:
parent
92396ae5ba
commit
b2955d9065
6 changed files with 86 additions and 12 deletions
|
|
@ -588,8 +588,10 @@ def test_row_foreign_key_tables(app_client):
|
|||
|
||||
|
||||
def test_unit_filters(app_client):
|
||||
response = app_client.get('/test_tables/units.json?distance__lt=75km&frequency__gt=1kHz',
|
||||
gather_request=False)
|
||||
response = app_client.get(
|
||||
'/test_tables/units.json?distance__lt=75km&frequency__gt=1kHz',
|
||||
gather_request=False
|
||||
)
|
||||
assert response.status == 200
|
||||
data = response.json
|
||||
|
||||
|
|
@ -598,3 +600,11 @@ def test_unit_filters(app_client):
|
|||
|
||||
assert len(data['rows']) == 1
|
||||
assert data['rows'][0][0] == 2
|
||||
|
||||
|
||||
def test_plugins_dir_plugin(app_client):
|
||||
response = app_client.get(
|
||||
"/test_tables.json?sql=select+convert_units(100%2C+'m'%2C+'ft')",
|
||||
gather_request=False
|
||||
)
|
||||
assert pytest.approx(328.0839) == response.json['rows'][0][0]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue