<commit_before>#!/usr/bin/env python
# flake8: noqa

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

# get version
with open('memsql/__init__.py') as f:
    exec(f.read())

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

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

setup(
    name='memsql',
    version=__version__,    # this is defined by the "exec(f.read())" at the top of this file.
    author='MemSQL',
    author_email='<EMAIL>',
    url='http://github.com/memsql/memsql-python',

    license='LICENSE.txt',
    description='Useful utilities and plugins for MemSQL integration.',
    long_description=open('README.rst').read(),

    packages=[ 'memsql', 'memsql.collectd', 'memsql.common', ],
    install_requires=['ordereddict', 'MySQL-python>=1.2.4', 'wraptor', 'netifaces'],
    tests_require=['pytest', 'mock'],
    cmdclass={ 'test': PyTest },
)<commit_msg>test watcher, and sub dir support<commit_after>#!/usr/bin/env python

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

# get version
from memsql import __version__

class PyTest(TestCommand):
    user_options = [
        ('watch', 'w',
         "watch tests for changes"),
        ('scan-directory=', 'd',
         "only search for tests in the specified directory"),
    ]
    boolean_options = ['watch']

    def initialize_options(self):
        self.watch = False
        self.scan_directory = None
        self.test_suite = None
        self.test_module = None
        self.test_loader = None

    def finalize_options(self):
        TestCommand.finalize_options(self)

        self.test_suite = True
        self.test_args = []
        if self.watch:
            self.test_args.append('-f')
        if self.scan_directory is not None:
            self.test_args.append(self.scan_directory)

    def run_tests(self):
        import os, sys

        MY_PATH = os.path.dirname(__file__)
        sys.path.append(MY_PATH)
        os.environ['PYTHONPATH'] = os.environ.get('PYTHONPATH', '') + ':' + MY_PATH

        import pytest
        errno = pytest.main(self.test_args)
        raise sys.exit(errno)

setup(
    name='memsql',
    version=__version__,    # this is defined by the "exec(f.read())" at the top of this file.
    author='MemSQL',
    author_email='<EMAIL>',
    url='http://github.com/memsql/memsql-python',

    license='LICENSE.txt',
    description='Useful utilities and plugins for MemSQL integration.',
    long_description=open('README.rst').read(),

    packages=[ 'memsql', 'memsql.collectd', 'memsql.common', ],
    install_requires=['ordereddict', 'MySQL-python>=1.2.4', 'wraptor', 'netifaces'],
    tests_require=['pytest', 'mock'],
    cmdclass={ 'test': PyTest },
)
{'fraction_non_alphanumeric': 0.1359918200408998, 'fraction_numerical': 0.0023858214042263124, 'mean_word_length': 3.0877437325905293, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '841111', 'n_tokens_mistral': 933, 'n_tokens_neox': 937, 'n_words': 206}