-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* use new pytest fixtures * fix usage of code factory * fix test of cli * bump minimal aiida-core version to 1.0 * update aiida-diff version to 1.0.0 * pre-commit: move yapf to virtualenv, update version of modernizer * fix check-syntax.sh script (would not delete files if removed from package)
- Loading branch information
Showing
9 changed files
with
28 additions
and
180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,4 @@ | |
|
||
from __future__ import absolute_import | ||
|
||
__version__ = "1.0.0b1" | ||
__version__ = "1.0.0" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,15 @@ | ||
""" | ||
For pytest | ||
initialise a text database and profile | ||
""" | ||
"""pytest fixtures for simplified testing.""" | ||
from __future__ import absolute_import | ||
import tempfile | ||
import shutil | ||
import pytest | ||
|
||
from aiida.manage.fixtures import fixture_manager | ||
|
||
|
||
@pytest.fixture(scope='session', autouse=True) | ||
def aiida_profile(): | ||
"""Set up a test profile for the duration of the tests""" | ||
with fixture_manager() as fixture_mgr: | ||
yield fixture_mgr | ||
pytest_plugins = ['aiida.manage.tests.pytest_fixtures'] | ||
|
||
|
||
@pytest.fixture(scope='function', autouse=True) | ||
def clear_database(aiida_profile): | ||
"""Clear the database after each test""" | ||
yield | ||
aiida_profile.reset_db() | ||
|
||
|
||
@pytest.fixture(scope='function') | ||
def new_workdir(): | ||
"""Get a temporary folder to use as the computer's work directory.""" | ||
dirpath = tempfile.mkdtemp() | ||
yield dirpath | ||
shutil.rmtree(dirpath) | ||
|
||
|
||
@pytest.fixture(scope='function') | ||
def aiida_localhost_computer(new_workdir): | ||
"""Get an AiiDA computer for localhost. | ||
:return: The computer node | ||
:rtype: :py:class:`aiida.orm.Computer` | ||
""" | ||
from aiida_diff.helpers import get_computer | ||
|
||
computer = get_computer(workdir=new_workdir) | ||
|
||
return computer | ||
|
||
|
||
def clear_database_auto(clear_database): # pylint: disable=unused-argument | ||
"""Automatically clear database in between tests.""" | ||
@pytest.fixture(scope='function') | ||
def aiida_code(aiida_localhost_computer): | ||
"""Get an AiiDA code. | ||
:return: The code node | ||
:rtype: :py:class:`aiida.orm.Code` | ||
def diff_code(aiida_local_code_factory): | ||
"""Get a diff code. | ||
""" | ||
from aiida_diff.helpers import get_code | ||
|
||
code = get_code(entry_point='diff', computer=aiida_localhost_computer) | ||
|
||
return code | ||
diff_code = aiida_local_code_factory(executable='diff', entry_point='diff') | ||
return diff_code |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters