• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

aiidateam / aiida_core / 5961 / 5
74%
develop: 74%

Build:
DEFAULT BRANCH: develop
Ran 30 Apr 2019 05:02PM UTC
Files 385
Run time 22s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

30 Apr 2019 04:49PM UTC coverage: 65.437% (-0.3%) from 65.731%
TEST_AIIDA_BACKEND=django TEST_TYPE="tests"

push

travis-ci

szoupanos
Properly unload database environment when swapping profiles

The experimental functionality to switch profile within the same
interpreter that was recently introduced, suffered a fatal flaw. Even
though the `load_profile` function correctly reset the `Manager`, which
would hold references configured for the old profile, it did not
consider database specific resources. The `Backend` instance was
properly reset, but both the Django and SqlAlchemy implementations also
configure an engine or connection to the database, based on the database
connection details specified for the profile.

These resources were not properly being reset and recreated after
changing profiles, causing the wrong database to be used. This was
discovered in the unittests for `verdi quicksetup/setup`. These tests
would create a complete temporary AiiDA instance complete with postgres
cluster and create a new profile, to which it would then switch for the
duration of the test. After the test, the original test session
variables would be restored. However, the database environment was never
actually being swapped, causing the tests not to use the temporary
database, but that of the general test session.

This problem is addressed, by implementing an `unload_dbenv` function
that destroys the database resources that are initialized by the
`load_dbenv` counterpart. This function is called when the manager is
reset, which in turn is called in `load_profile` when the profile is
switched.

For SqlAlchemy, the unloading is accomplished by disposing the current
engine and resetting the scoped session class by calling`reset_session`
which will reset the global variables in `aiida.backends.sqlalchemy`.

The `unload_dbenv` for Django has not yet been implemented. The
mechanism for loading the database environment for Django is to import
the settings file, which will define global variables based on the
current profile, which will be used by Django to create a database
connection. It is currently... (continued)

21396 of 32697 relevant lines covered (65.44%)

0.65 hits per line

Source Files on job 5961.5 (TEST_AIIDA_BACKEND=django TEST_TYPE="tests")
  • Tree
  • List 0
  • Changed 16
  • Source Changed 7
  • Coverage Changed 14
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 1657
  • Travis Job 5961.5
  • 0fc7ff27 on github
  • Prev Job for TEST_AIIDA_BACKEND=django TEST_TYPE="tests" on develop (#5957.5)
  • Next Job for TEST_AIIDA_BACKEND=django TEST_TYPE="tests" on develop (#5969.6)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc