~canonical-livepatch-dependencies/canonical-livepatch-service-dependencies/sqlalchemy

« back to all changes in this revision

Viewing changes to test/conftest.py

  • Committer: Free Ekanayaka
  • Author(s): Piotr Ożarowski
  • Date: 2016-06-05 20:53:44 UTC
  • Revision ID: free.ekanayaka@canonical.com-20160605205344-y5n5bo3sf9oc1irq
Tags: upstream-1.0.13+ds1
Import upstream version 1.0.13+ds1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
"""
 
3
pytest plugin script.
 
4
 
 
5
This script is an extension to py.test which
 
6
installs SQLAlchemy's testing plugin into the local environment.
 
7
 
 
8
"""
 
9
import sys
 
10
import os
 
11
 
 
12
if not sys.flags.no_user_site:
 
13
    sys.path.insert(
 
14
        0,
 
15
        os.path.join(
 
16
            os.path.dirname(os.path.abspath(__file__)), '..', 'lib')
 
17
    )
 
18
 
 
19
# use bootstrapping so that test plugins are loaded
 
20
# without touching the main library before coverage starts
 
21
bootstrap_file = os.path.join(
 
22
    os.path.dirname(__file__), "..", "lib", "sqlalchemy",
 
23
    "testing", "plugin", "bootstrap.py"
 
24
)
 
25
 
 
26
with open(bootstrap_file) as f:
 
27
    code = compile(f.read(), "bootstrap.py", 'exec')
 
28
    to_bootstrap = "pytest"
 
29
    exec(code, globals(), locals())
 
30
    from pytestplugin import *  # noqa