kopia lustrzana https://github.com/simonw/datasette
				
				
				
			Ensure db.path is a string before trying to insert into internal database (#1370)
Thanks, @eyeseastpull/1368/head
							rodzic
							
								
									5335f360f4
								
							
						
					
					
						commit
						a6c55afe8c
					
				|  | @ -354,7 +354,7 @@ class Datasette: | |||
|                 INSERT OR REPLACE INTO databases (database_name, path, is_memory, schema_version) | ||||
|                 VALUES (?, ?, ?, ?) | ||||
|             """, | ||||
|                 [database_name, db.path, db.is_memory, schema_version], | ||||
|                 [database_name, str(db.path), db.is_memory, schema_version], | ||||
|                 block=True, | ||||
|             ) | ||||
|             await populate_schema_tables(internal_db, db) | ||||
|  |  | |||
|  | @ -25,6 +25,7 @@ from .fixtures import (  # noqa | |||
|     METADATA, | ||||
| ) | ||||
| import json | ||||
| import pathlib | ||||
| import pytest | ||||
| import sys | ||||
| import urllib | ||||
|  | @ -2123,3 +2124,16 @@ def test_col_nocol_errors(app_client, path, expected_error): | |||
|     response = app_client.get(path) | ||||
|     assert response.status == 400 | ||||
|     assert response.json["error"] == expected_error | ||||
| 
 | ||||
| 
 | ||||
| @pytest.mark.asyncio | ||||
| async def test_db_path(app_client): | ||||
|     db = app_client.ds.get_database() | ||||
|     path = pathlib.Path(db.path) | ||||
| 
 | ||||
|     assert path.exists() | ||||
| 
 | ||||
|     datasette = Datasette([path]) | ||||
| 
 | ||||
|     # this will break with a path | ||||
|     await datasette.refresh_schemas() | ||||
|  |  | |||
		Ładowanie…
	
		Reference in New Issue
	
	 Chris Amico
						Chris Amico