Skip to content

syhpoon/xenvman-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python client for xenvman

This is a Python client library for xenvman.

Installation

Installing is a simple as running:

pip install xenvman

Usage

The very first thing to do is to create a client:

import xenvman

cl = xenvman.Client()

if address argument is not provided, the default http://localhost:9876 will be used. Also if shell environment variable XENV_API_SERVER is set, it will be used instead.

Once you have a client, you can create environment:

env = cl.new_env(xenvman.InputEnv(
    "python-test",
    description="Python test!",
    templates=[
        xenvman.Tpl("db/mongo")
    ],
))

And that's it! Once new_env() returns, you have an environment which you can start using in your integration tests.

cont = env.get_container("db/mongo", 0, "mongo")

# Get the full mongo url with exposed port
mongo_url = "{}:{}".format(env.external_address(), cont.ports["27017"])

Don't forget to terminate your env after you're done:

env.terminate()

About

Python client for xenvman

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages