Skip to content

Commit

Permalink
Merge pull request #130 from Leusmann/bugfix-database-merger
Browse files Browse the repository at this point in the history
Fixes an error where only the first test would be sucessful
  • Loading branch information
Tigul authored Jan 22, 2024
2 parents b499e78 + 04d2105 commit 6c0fdea
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions test/test_database_merger.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,17 @@ def setUpClass(cls) -> None:
cls.source_engine = sqlalchemy.create_engine("sqlite+pysqlite:///:memory:", echo=False)
cls.source_session_maker = sqlalchemy.orm.sessionmaker(bind=cls.source_engine)
cls.destination_session_maker = sqlalchemy.orm.sessionmaker(bind=cls.destination_engine)
source_session = cls.source_session_maker()
destination_session = cls.destination_session_maker()
pycram.orm.base.Base.metadata.create_all(cls.source_engine)
pycram.orm.base.Base.metadata.create_all(cls.destination_engine)
source_session.commit()
destination_session.commit()
source_session.close()
destination_session.close()
cls.numbers_of_example_runs = 3

def setUp(self) -> None:
super().setUp()
source_session = self.source_session_maker()
# If there is no session (connection to the memory database) it resets thus we need to define this here
pycram.orm.base.Base.metadata.create_all(self.source_engine)
example_plans = ExamplePlans()
for i in range(self.numbers_of_example_runs):
try:
Expand Down Expand Up @@ -151,7 +149,7 @@ def test_merge_databases(self):
self.assertEqual(destination_content[key], destination_content[key].union(source_content[key]))

def test_migrate_neems(self):
pycram.orm.utils.migrate_neems(self.source_session_maker,self.destination_session_maker)
pycram.orm.utils.migrate_neems(self.source_session_maker, self.destination_session_maker)
destination_content = dict()
source_content = dict()
with self.destination_session_maker() as session:
Expand Down

0 comments on commit 6c0fdea

Please sign in to comment.