How to use setuptools - 10 common examples

To help you get started, we’ve selected a few setuptools examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github astropy / pytest-doctestplus / command.py View on Github external
pass
        else:
            sys.argv[idx] = '--remote-data=any'

        try:
            idx = sys.argv.index('-R')
        except ValueError:
            pass
        else:
            sys.argv[idx] = '-R=any'

        return super(FixRemoteDataOption, cls).__init__(name, bases, dct)


@six.add_metaclass(FixRemoteDataOption)
class AstropyTest(Command, object):
    description = 'Run the tests for this package'

    user_options = [
        ('package=', 'P',
         "The name of a specific package to test, e.g. 'io.fits' or 'utils'.  "
         "If nothing is specified, all default tests are run."),
        ('test-path=', 't',
         'Specify a test location by path.  If a relative path to a  .py file, '
         'it is relative to the built package, so e.g., a  leading "astropy/" '
         'is necessary.  If a relative  path to a .rst file, it is relative to '
         'the directory *below* the --docs-path directory, so a leading '
         '"docs/" is usually necessary.  May also be an absolute path.'),
        ('verbose-results', 'V',
         'Turn on verbose output from pytest.'),
        ('plugins=', 'p',
         'Plugins to enable when running pytest.'),
github opennode / waldur-core / waldur_core / core / test_runner.py View on Github external
def initialize_options(self):
        TestCommand.initialize_options(self)
        self.parallel = 0
github Parsely / testinstances / setup.py View on Github external
def initialize_options(self):
        TestCommand.initialize_options(self)
        self.pytest_args = []
github eeaston / page-objects / tests / unit / pkglib / test_test_egg_unit.py View on Github external
def get_cmd():
    return test_egg.test_egg(Distribution({'name': 'acme.foo',
                                           'tests_require': ['bar', 'baz'],
                                           'namespace_packages': ['acme'],
                                           'packages': ['acme.foo']}))
github humenda / GladTeX / setup.py View on Github external
import os
import setuptools

with open(os.path.join('gleetex', '__init__.py')) as f:
    global VERSION
    import re
    for line in f.read().split('\n'):
        vers = re.search(r'^VERSION\s+=\s+.(\d+\.\d+\.\d+)', line)
        if vers:
            VERSION = vers.groups()[0]
    if not VERSION:
        class SetupError(Exception):
            pass
        raise SetupError("Error parsing package version")

setuptools.setup(name='GladTeX',
      version=VERSION,
      description="Formula typesetting for the web using LaTeX",
      long_description="""Formula typesetting for the web

This package (and command-line application) allows to create web documents with
properly typeset formulas. It uses the embedded LaTeX formulas from the source
document to place SVG images at the right positions on the web page. For people
not able to see the images (due to a poor internet connection or because of a
disability), the LaTeX formula is preserved in the alt tag of the SVG image.
GladTeX hence combines proper math typesetting on the web with the creation of
accessible scientific documents.""",
      long_description_content_type = "text/markdown",
      author='Sebastian Humenda',
      author_email='shumenda@gmx.de',
      url='https://humenda.github.io/GladTeX',
      packages=['gleetex'],
github teozkr / Flask-Pushrod / setup.py View on Github external
from setuptools import setup
from setuptools.command.test import test as TestCommand

from os import path


class PyTest(TestCommand):
    def finalize_options(self):
        TestCommand.finalize_options(self)
        self.test_args = []
        self.test_suite = True

    def run_tests(self):
        #import here, cause outside the eggs aren't loaded
        import pytest
        raise SystemExit(pytest.main(self.test_args))


setup(
    name='Flask-Pushrod',
    version='0.2.dev',
    url='http://github.com/dontcare4free/flask-pushrod',
    license='MIT',
github christopher-ramirez / secretary / setup.py View on Github external
# -*- coding: utf-8 -*-

import sys
from setuptools import setup
from setuptools.command.test import test as TestCommand

long_description = """
============
Secretary
============
Take the power of Jinja2 templates to OpenOffice or LibreOffice and create reports and letters in your web applications.

See full `documentation on Github `_
."""

class PyTest(TestCommand):
    def finalize_options(self):
        TestCommand.finalize_options(self)
        self.test_args = []
        self.test_suite = True

    def run_tests(self):
        import pytest
        errno = pytest.main(self.test_args)
        sys.exit(errno)

setup(
    name='secretary',
    version='0.2.19',
    url='https://github.com/christopher-ramirez/secretary',
    license='MIT',
    author='Christopher Ramírez',
github kengz / SLM-Lab / setup.py View on Github external
'--capture=sys',
    '--log-level=INFO',
    '--log-cli-level=INFO',
    '--log-file-level=INFO',
    '--no-flaky-report',
    '--timeout=300',
    '--cov-report=html',
    '--cov-report=term',
    '--cov-report=xml',
    '--cov=slm_lab',
    '--ignore=test/spec/test_dist_spec.py',
    'test',
]


class PyTest(TestCommand):
    user_options = [('pytest-args=', 'a', 'Arguments to pass to py.test')]

    def initialize_options(self):
        os.environ['PY_ENV'] = 'test'
        TestCommand.initialize_options(self)
        self.pytest_args = test_args

    def run_tests(self):
        import pytest
        errno = pytest.main(self.pytest_args)
        sys.exit(errno)


setup(
    name='slm_lab',
    version='4.0.1',
github NLPatVCU / medaCy / setup.py View on Github external
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
from medacy import __version__, __authors__
import sys

packages = find_packages()

def readme():
    with open('README.md') as f:
        return f.read()

class PyTest(TestCommand):
    """
    Custom Test Configuration Class
    Read here for details: https://docs.pytest.org/en/latest/goodpractices.html
    """
    user_options = [("pytest-args=", "a", "Arguments to pass to pytest")]

    def initialize_options(self):
        TestCommand.initialize_options(self)
        self.pytest_args = "--cov-config .coveragerc --cov-report html --cov-report term --cov=medacy"

    def run_tests(self):
        import shlex
        # import here, cause outside the eggs aren't loaded
        import pytest

        errno = pytest.main(shlex.split(self.pytest_args))
github datalib / libextract / setup.py View on Github external
import sys
from setuptools import setup
from setuptools.command.test import test as TestCommand


class PyTest(TestCommand):
    user_options = []

    def initialize_options(self):
        TestCommand.initialize_options(self)
        self.pytest_args = ['-v']

    def finalize_options(self):
        TestCommand.finalize_options(self)
        self.test_args = []
        self.test_suite = True

    def run_tests(self):
        import pytest
        errno = pytest.main(self.pytest_args)
        sys.exit(errno)