Metadata-Version: 1.1
Name: pytest-devpi-server
Version: 1.1.0
Summary: DevPI server fixture for py.test
Home-page: https://github.com/manahl/pytest-plugins
Author: Edward Easton
Author-email: eeaston@gmail.com
License: MIT license
Description: Py.test DevPi Server Fixture
        ============================
        
        DevPi server fixture for ``py.test``. The server is session-scoped by
        default and run in a subprocess and temp dir to cleanup when it's done.
        
        After the server has started up it will create a single user with a
        password, and an index for that user. It then activates that index and
        provides a handle to the ``devpi-client`` API so you can manipulate the
        server in your tests.
        
        Installation
        ------------
        
        Install using your favourite package manager:
        
        .. code:: bash
        
                pip install pytest-devpi-server
                #  or..
                easy_install pytest-devpi-server
        
        Enable the fixture explicitly in your tests or conftest.py (not required
        when using setuptools entry points):
        
        .. code:: python
        
                pytest_plugins = ['pytest_devpi_server']
        
        Example
        -------
        
        Here's a noddy test case showing the main functionality:
        
        .. code:: python
        
                def test_devpi_server(devpi_server):
                    # This is the client API for the server that's bound directly to the 'devpi' command-line tool.
                    # Here we list the available indexes
                    print devpi_server.api('use', '-l')
                    
                    # Create and use another index
                    devpi_server.api('index', '-c', 'myindex')
                    devpi_server.api('index', 'use', 'myindex')
        
                    # Upload a package 
                    import os
                    os.chdir('/path/to/my/setup/dot/py')
                    devpi_server.api('upload')
        
                    # Get some json data
                    import json
                    res = devpi_server.api('getjson', '/user/myindex')
                    assert json.loads(res)['result']['projects'] == ['my-package-name']
        
        ``DevpiServer`` class
        ---------------------
        
        Using this with the default ``devpi_server`` py.test fixture is good
        enough for a lot of use-cases however you may wish to have more
        fine-grained control about the server configuration.
        
        To do this you can use the underlying server class directly - this is an
        implenentation of the ``pytest-server-fixture`` framework and as such
        acts as a context manager:
        
        .. code:: python
        
                import json
                from pytest_devpi_server import DevpiServer
                
                def test_custom_server():
                    with DevPiServer(
                          # You can specify you own initial user and index
                          user='bob',
                          password='secret',
                          index='myindex',
        
                          # You can provide a zip file that contains the initial server database, 
                          # this is useful to pre-load any required packages for a test run
                          data='/path/to/data.zip'
                       ) as server:
        
                           assert not server.dead
                           res = server.api('getjson', '/bob/myindex')
                           assert 'pre-loaded-package' in json.loads(res)['result']['projects'] 
                           
                    # Server should now be dead
                    assert server.dead   
        
        
        Changelog
        ---------
        
        1.1.0 (2016-2-15)
        ~~~~~~~~~~~~~~~~~
        
        -  New plugin: devpi server fixture
        -  pytest-profiling improvement: overly-long .prof files are saved as
           the short hash of the test name (Thanks to Vladimir Lagunov for PR)
        -  Changed default behavior of workspace.run() to not use a subshell for
           security reasons
        -  Corrected virtualenv.run() method to handle arguments the same as the
           parent method workspace.run()
        -  Removed deprecated '--distribute' from virtualenv args
        
        1.0.1 (2015-12-23)
        ~~~~~~~~~~~~~~~~~~
        
        -  Packaging bugfix
        
        1.0.0 (2015-12-21)
        ~~~~~~~~~~~~~~~~~~
        
        -  Initial public release
        
        
Platform: unix
Platform: linux
Classifier: License :: OSI Approved :: MIT License
Classifier: Development Status :: 5 - Production/Stable
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Testing
Classifier: Topic :: Utilities
Classifier: Intended Audience :: Developers
Classifier: Operating System :: POSIX
Classifier: Framework :: Pyramid
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
