
Add the capability to the --no-discover option to convert file names into regular sexpressions. Also add the --path option that converts a file or directory to a regular expression. Create a mutually exclusive argparse group for --regex, --path, and --no-discover. This change will allow the user to specify a file name instead of a regular expression to match a particular set of tests e.g: tox -e py27 -- --path os_testr/tests/test_os_testr.py Will run os_testr.tests.test_os_testr but you can use tab complete to generate the name. Change-Id: Ibfca2bc023aed44b1b87a0444559ab2a00303a70
33 lines
1.0 KiB
Python
33 lines
1.0 KiB
Python
# -*- coding: utf-8 -*-
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
"""
|
|
test_os_testr
|
|
----------------------------------
|
|
|
|
Tests for `os_testr` module.
|
|
"""
|
|
|
|
from os_testr import os_testr
|
|
from os_testr.tests import base
|
|
|
|
|
|
class Test_Construct_Regex(base.TestCase):
|
|
|
|
def test_file_name(self):
|
|
result = os_testr.path_to_regex("tests/network/v2/test_net.py")
|
|
self.assertEqual("tests.network.v2.test_net", result)
|
|
result = os_testr.path_to_regex("openstack/tests/network/v2")
|
|
self.assertEqual("openstack.tests.network.v2", result)
|