Skip to content

Instantly share code, notes, and snippets.

@leapp-bot
Created September 3, 2018 10:51
Show Gist options
  • Save leapp-bot/99f7a89b6e0bccab6ab8eb7ddfaeaa36 to your computer and use it in GitHub Desktop.
Save leapp-bot/99f7a89b6e0bccab6ab8eb7ddfaeaa36 to your computer and use it in GitHub Desktop.
build-reports
. tut/bin/activate; \
python utils/run_pytest.py --actor= --report=/tmp/test-logs/report.xml
============================= test session starts ==============================
platform linux2 -- Python 2.7.5, pytest-3.6.4, py-1.6.0, pluggy-0.7.1 -- /tmp/leapp-actors/tut/bin/python2.7
cachedir: .pytest_cache
rootdir: /tmp/leapp-actors, inifile:
plugins: ordering-0.5, leapp-0.3
collecting ... collected 2 items
repos/common/actors/augeasscanner/tests/test_augeasscanner.py::test_no_input_execution ERROR [ 50%]
repos/common/actors/testactor/tests/test_testactor.py::test_testactor PASSED [100%]
==================================== ERRORS ====================================
__________________ ERROR at setup of test_no_input_execution ___________________
request = <SubRequest 'loaded_leapp_repository' for <Function 'test_no_input_execution'>>
@pytest.fixture(scope='module')
def loaded_leapp_repository(request):
"""
This fixture will ensure that the repository for the current test run is loaded with all its links etc.
This enables running actors and using models, tags, topics, workflows etc.
Additionally loaded_leapp_repository gives you access to a :py:class:`leapp.repository.manager.RepositoryManager`
instance.
:Example:
.. code-block:: python
from leapp.snactor.fixture import loaded_leapp_repository
from leapp.models import ExampleModel, ProcessedExampleModel
def my_repository_library_test(loaded_leapp_repository):
from leapp.libraries.common import global
e = ExampleModel(value='Some string')
result = global.process_function(e)
assert type(result) is ProcessedExampleModel
"""
repository_path = find_repository_basedir(request.module.__file__)
os.environ['LEAPP_CONFIG'] = os.path.join(repository_path, '.leapp', 'leapp.conf')
os.environ['LEAPP_HOSTNAME'] = socket.getfqdn()
context = str(uuid.uuid4())
> with get_connection(None):
tut/lib/python2.7/site-packages/leapp/snactor/fixture.py:154:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tut/lib/python2.7/site-packages/leapp/utils/audit/__init__.py:55: in get_connection
return create_connection(cfg.get('database', 'path'))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
path = '/var/lib/leapp/leapp.db'
def create_connection(path):
"""
Creates a database connection to the path and ensures it's initialized and up to date.
:param path: Path to the database
:return: Connection object
"""
> return _initialize_database(sqlite3.connect(path))
E OperationalError: unable to open database file
tut/lib/python2.7/site-packages/leapp/utils/audit/__init__.py:42: OperationalError
---------------- generated xml file: /tmp/test-logs/report.xml -----------------
====================== 1 passed, 1 error in 0.17 seconds =======================
['pytest', '-v', 'repos', '--junit-xml=/tmp/test-logs/report.xml']
make: *** [test] Error 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment