Skip to content

Commit

Permalink
Merge pull request #26 from Ensembl/jalvarez/bugfixes
Browse files Browse the repository at this point in the history
Several bugfixes following the latest additions and better testing
  • Loading branch information
JAlvarezJarreta authored Sep 20, 2024
2 parents dbe2ef5 + 0d2c7dc commit 2a00819
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/ensembl/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.
"""Ensembl Python general-purpose utils library."""

__version__ = "0.4.4"
__version__ = "0.5.0"

__all__ = [
"StrPath",
Expand Down
7 changes: 3 additions & 4 deletions src/ensembl/utils/database/unittestdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,17 +126,16 @@ def _load_schema_and_data(

# Load the schema
if metadata:
self.dbc.create_all_tables(metadata)
metadata.create_all(conn)
elif dump_dir:
dump_dir_path = Path(dump_dir)
with open(dump_dir_path / "table.sql", "r") as schema:
with Path(dump_dir, "table.sql").open("r") as schema:
for query in "".join(schema.readlines()).split(";"):
if query.strip():
conn.execute(text(query))

# And import any available data for each table
if dump_dir:
for tsv_file in dump_dir_path.glob("*.txt"):
for tsv_file in Path(dump_dir).glob("*.txt"):
table = tsv_file.stem
self._load_data(conn, table, tsv_file)

Expand Down
4 changes: 3 additions & 1 deletion src/ensembl/utils/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,9 @@ def test_method(..., test_dbs: dict[str, UnitTestDB], ...):
"""
databases = {}
for argument in request.param:
src = Path(argument["src"])
src = argument.get("src", None)
if src is not None:
src = Path(src)
name = argument.get("name", None)
key = name if name else src.name
databases[key] = db_factory(src=src, name=name, metadata=argument.get("metadata"))
Expand Down

0 comments on commit 2a00819

Please sign in to comment.