def loop():

    if len(sys.argv) < 2:
        print_usage()
        sys.exit(1)

    rev_file = os.path.join(os.getcwd(), '.rev')
    print 'restoring last state from "%s"' % rev_file

    try:
        last_rev = int(open(rev_file, 'r').read())
    except:
        last_rev = run_tests.svn_info()[0] - 1
        open(rev_file, 'w+').write('%d' % last_rev)

    while True:
        revs = svn_fetch(last_rev)

        for r in revs:
            print '\n\nREVISION %d ===\n' % r
            svn_up(r)

            run_tests.main(sys.argv[1:])
            last_rev = r

            open(rev_file, 'w+').write('%d' % last_rev)

        if revs == []: time.sleep(300)
Пример #2
0
def loop():

	if len(sys.argv) < 2:
		print_usage()
		sys.exit(1)

	rev_file = os.path.join(os.getcwd(), '.rev')
	print 'restoring last state from "%s"' % rev_file

	try:
		last_rev = int(open(rev_file, 'r').read())
	except:
		last_rev = run_tests.svn_info()[0] - 1
		open(rev_file, 'w+').write('%d' % last_rev)

	while True:
		revs = svn_fetch(last_rev)

		for r in revs:
			print '\n\nREVISION %d ===\n' % r
			svn_up(r)
	
			run_tests.main(sys.argv[1:])
			last_rev = r;

			open(rev_file, 'w+').write('%d' % last_rev)
	
		if revs == []: time.sleep(300)
Пример #3
0
 def run(self):
     this_dir = os.getcwd()
     # Change to the test dir and run the tests
     os.chdir('Tests')
     sys.path.insert(0, '')
     import run_tests
     run_tests.main([])
     # Change back to the current directory
     os.chdir(this_dir)
Пример #4
0
 def run(self):
     this_dir = os.getcwd()
     # Change to the test dir and run the tests
     os.chdir('Tests')
     sys.path.insert(0, '')
     import run_tests
     run_tests.main([])
     # Change back to the current directory
     os.chdir(this_dir)
Пример #5
0
    def run(self):
        """Run the test script tests/run_tests.py"""
        currdir = os.getcwd()
        os.chdir("tests")
        sys.path.insert(0, "")
        import run_tests

        run_tests.main()
        os.chdir(currdir)
def loop():

    if len(sys.argv) < 2:
        print_usage()
        sys.exit(1)

    skip = '-s' in sys.argv

    rev_file = os.path.join(os.getcwd(), '.rev')
    if skip:
        sys.argv.remove('-s')
    print 'restoring last state from "%s"' % rev_file

    try:
        last_rev = int(open(rev_file, 'r').read())
    except:
        last_rev = run_tests.svn_info()[0] - 1
        open(rev_file, 'w+').write('%d' % last_rev)

    revs = []

    while True:
        new_revs = svn_fetch(last_rev)

        if len(new_revs) > 0:
            revs = new_revs + revs

        # in skip mode, only ever run the latest version
        if skip and len(revs): revs = revs[:1]

        if revs == []:
            time.sleep(300)
            continue

        print 'revs: ',
        for r in revs:
            print '%d ' % r,
        print ''

        r = revs[0]
        print '\n\nREVISION %d ===\n' % r
        svn_up(r)

        try:
            run_tests.main(sys.argv[1:])
            last_rev = r

            # pop the revision we just completed
            revs = revs[1:]

            open(rev_file, 'w+').write('%d' % last_rev)
        except Exception, e:
            print e
Пример #7
0
def loop():

	if len(sys.argv) < 2:
		print_usage()
		sys.exit(1)

	skip = '-s' in sys.argv

	rev_file = os.path.join(os.getcwd(), '.rev')
	if skip:
		sys.argv.remove('-s')
	print 'restoring last state from "%s"' % rev_file

	try:
		last_rev = int(open(rev_file, 'r').read())
	except:
		last_rev = run_tests.svn_info()[0] - 1
		open(rev_file, 'w+').write('%d' % last_rev)

	revs = []

	while True:
		new_revs = svn_fetch(last_rev)

		if len(new_revs) > 0:
			revs = new_revs + revs

		# in skip mode, only ever run the latest version
		if skip and len(revs): revs = revs[:1]

		if revs == []:
			time.sleep(300)
			continue

		print 'revs: ',
		for r in revs: print '%d ' % r,
		print ''

		r = revs[0]
		print '\n\nREVISION %d ===\n' % r
		svn_up(r)

		try:
			run_tests.main(sys.argv[1:])
			last_rev = r;

			# pop the revision we just completed
			revs = revs[1:]

			open(rev_file, 'w+').write('%d' % last_rev)
		except Exception, e:
			print e
Пример #8
0
def loop():

    if len(sys.argv) < 2:
        print_usage()
        sys.exit(1)

    skip = "-s" in sys.argv

    rev_file = os.path.join(os.getcwd(), ".rev")
    if skip:
        sys.argv.remove("-s")
    print 'restoring last state from "%s"' % rev_file

    try:
        last_rev = int(open(rev_file, "r").read())
    except:
        last_rev = run_tests.svn_info()[0] - 1
        open(rev_file, "w+").write("%d" % last_rev)

    revs = []

    while True:
        new_revs = svn_fetch(last_rev)

        if len(new_revs) > 0:
            revs = new_revs + revs

            # in skip mode, only ever run the latest version
        if skip and len(revs):
            revs = revs[:1]

        if revs == []:
            time.sleep(300)
            continue

        print "revs: ",
        for r in revs:
            print "%d " % r,
        print ""

        r = revs[0]
        print "\n\nREVISION %d ===\n" % r
        svn_up(r)

        run_tests.main(sys.argv[1:])
        last_rev = r

        # pop the revision we just completed
        revs = revs[1:]

        open(rev_file, "w+").write("%d" % last_rev)
Пример #9
0
    def run(self):
        """Run the tests."""
        this_dir = os.getcwd()

        # change to the test dir and run the tests
        os.chdir("Tests")
        sys.path.insert(0, "")
        import run_tests
        if self.offline:
            run_tests.main(["--offline"])
        else:
            run_tests.main([])

        # change back to the current directory
        os.chdir(this_dir)
Пример #10
0
 def test_main(self):
     try:
         rootdir = tempfile.mkdtemp()
         results_file = os.path.join(rootdir, "foo", "testfile.xml")
         placeholder = os.path.join(rootdir, "foo", "MISSING-testfile.xml")
         # check_file = os.path.join(rootdir, 'checkfile')
         # with open(src_file, 'w') as fhand:
         #     fhand.write('foo')
         # self.assertTrue(os.path.isfile(check_file))
         main([results_file, "true", "--working-dir", rootdir])
         self.assertFalse(os.path.exists(results_file))
         self.assertTrue(os.path.exists(placeholder))
         with open(placeholder, "r") as fhand:
             contents = fhand.read()
         self.assertTrue(results_file in contents)
         os.remove(placeholder)
         ###
         main(
             [
                 results_file,
                 'echo \'<testsuite tests="0" failures="0" errors="0"></testsuite>\' > %s' % results_file,
                 "--working-dir",
                 rootdir,
             ]
         )
         self.assertTrue(os.path.exists(results_file))
         self.assertFalse(os.path.exists(placeholder))
         os.remove(results_file)
         ### no working dir given
         main(
             [results_file, 'echo \'<testsuite tests="0" failures="0" errors="0"></testsuite>\' > %s' % results_file]
         )
         self.assertTrue(os.path.exists(results_file))
         self.assertFalse(os.path.exists(placeholder))
         os.remove(results_file)
         ### make sure resultsfile is deleted
         main([results_file, "true", "--working-dir", rootdir])
         self.assertFalse(os.path.exists(results_file))
         self.assertTrue(os.path.exists(placeholder))
         with open(placeholder, "r") as fhand:
             contents = fhand.read()
         self.assertTrue(results_file in contents)
     finally:
         shutil.rmtree(rootdir)
Пример #11
0
 def test_main(self):
     try:
         rootdir = tempfile.mkdtemp()
         results_file = os.path.join(rootdir, 'foo', 'testfile.xml')
         placeholder = os.path.join(rootdir, 'foo', 'MISSING-testfile.xml')
         # check_file = os.path.join(rootdir, 'checkfile')
         # with open(src_file, 'w') as fhand:
         #     fhand.write('foo')
         # self.assertTrue(os.path.isfile(check_file))
         main([results_file, 'true', '--working-dir', rootdir])
         self.assertFalse(os.path.exists(results_file))
         self.assertTrue(os.path.exists(placeholder))
         with open(placeholder, 'r') as fhand:
             contents = fhand.read()
         self.assertTrue(results_file in contents)
         os.remove(placeholder)
         ###
         main([
             results_file,
             "echo '<testsuite tests=\"0\" failures=\"0\" errors=\"0\"></testsuite>' > %s"
             % results_file, '--working-dir', rootdir
         ])
         self.assertTrue(os.path.exists(results_file))
         self.assertFalse(os.path.exists(placeholder))
         os.remove(results_file)
         ### no working dir given
         main([
             results_file,
             "echo '<testsuite tests=\"0\" failures=\"0\" errors=\"0\"></testsuite>' > %s"
             % results_file
         ])
         self.assertTrue(os.path.exists(results_file))
         self.assertFalse(os.path.exists(placeholder))
         os.remove(results_file)
         ### make sure resultsfile is deleted
         main([results_file, 'true', '--working-dir', rootdir])
         self.assertFalse(os.path.exists(results_file))
         self.assertTrue(os.path.exists(placeholder))
         with open(placeholder, 'r') as fhand:
             contents = fhand.read()
         self.assertTrue(results_file in contents)
     finally:
         shutil.rmtree(rootdir)
Пример #12
0
 def test_main(self):
     try:
         rootdir = tempfile.mkdtemp()
         results_file = os.path.join(rootdir, 'foo', 'testfile.xml')
         placeholder = os.path.join(rootdir, 'foo', 'MISSING-testfile.xml')
         # check_file = os.path.join(rootdir, 'checkfile')
         # with open(src_file, 'w') as fhand:
         #     fhand.write('foo')
         # self.assertTrue(os.path.isfile(check_file))
         main([results_file,
               'true',
               '--working-dir', rootdir])
         self.assertFalse(os.path.exists(results_file))
         self.assertTrue(os.path.exists(placeholder))
         with open(placeholder, 'r') as fhand:
             contents = fhand.read()
         self.assertTrue(results_file in contents)
         os.remove(placeholder)
         ###
         main([results_file,
               "echo '<testsuite></testsuite>' > %s" % results_file,
               '--working-dir', rootdir])
         self.assertTrue(os.path.exists(results_file))
         self.assertFalse(os.path.exists(placeholder))
         os.remove(results_file)
         ### no working dir given
         main([results_file,
               "echo '<testsuite></testsuite>' > %s" % results_file])
         self.assertTrue(os.path.exists(results_file))
         self.assertFalse(os.path.exists(placeholder))
         os.remove(results_file)
         ### make sure resultsfile is deleted
         main([results_file,
               'true',
               '--working-dir', rootdir])
         self.assertFalse(os.path.exists(results_file))
         self.assertTrue(os.path.exists(placeholder))
         with open(placeholder, 'r') as fhand:
             contents = fhand.read()
         self.assertTrue(results_file in contents)
     finally:
         shutil.rmtree(rootdir)
Пример #13
0
from run_tests import main

if __name__ == '__main__':
    main(generate=False)
Пример #14
0
if __name__ == '__main__':
    import run_tests
    run_tests.main()
Пример #15
0
if __name__ == '__main__':
  import run_tests
  run_tests.main ()
Пример #16
0
 def run_tests(self):
     import run_tests
     import sys
     errno = run_tests.main()
     sys.exit(errno)
Пример #17
0
 def run_tests(self):
     import run_tests
     import sys
     errno = run_tests.main()
     sys.exit(errno)
Пример #18
0
 def run(self):
     import run_tests
     run_tests.main()
Пример #19
0
#    License for the specific language governing permissions and limitations
#    under the License.
#

import argparse
import os
import sys

import run_tests


def import_tests():
    from trove.tests.examples import snippets
    snippets.monkey_patch_uuid_and_date()


if __name__ == "__main__":
    parser = argparse.ArgumentParser(description='Generate Example Snippets')
    parser.add_argument('--fix-examples',
                        action='store_true',
                        help='Fix the examples rather than failing tests.')

    args = parser.parse_args()
    if args.fix_examples:
        os.environ['TESTS_FIX_EXAMPLES'] = 'True'
        # Remove the '--fix-examples' argument from sys.argv as it is not a
        # valid argument in the run_tests module.
        sys.argv.pop(sys.argv.index('--fix-examples'))

    run_tests.main(import_tests)
Пример #20
0
 def run(self):
     import run_tests
     run_tests.main()
Пример #21
0
#    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.
#

import run_tests
import argparse
import os
import sys


def import_tests():
    from trove.tests.examples import snippets
    snippets.monkey_patch_uuid_and_date()


if __name__ == "__main__":
    parser = argparse.ArgumentParser(description='Generate Example Snippets')
    parser.add_argument('--fix-examples', action='store_true',
                        help='Fix the examples rather than failing tests.')

    args = parser.parse_args()
    if args.fix_examples:
        os.environ['TESTS_FIX_EXAMPLES'] = 'True'
        # Remove the '--fix-examples' argument from sys.argv as it is not a
        # valid argument in the run_tests module.
        sys.argv.pop(sys.argv.index('--fix-examples'))

    run_tests.main(import_tests)
Пример #22
0
 def run_tests(self):
     "Call from module test/run_tests.yml"
     import run_tests
     run_tests.main()
Пример #23
0
 def run(self):
     from run_tests import main
     main()
    def run_tests(self):
        "Call from module test/run_tests.yml"
        import run_tests

        run_tests.main()
Пример #25
0
parser.add_argument(
    "--dir",
    dest="dir",
    help="output HTML to directory",
    default="htmlcov/",
)
parser.add_argument(
    "--emit-data-file",
    dest="emit_data_file",
    help="emit a .coverage file",
    action="store_true",
)
args = parser.parse_args()

cov = Coverage(include="src/*",
               data_file=".coverage" if args.emit_data_file else None,
               branch=True)
cov.start()

import run_tests

run_tests.set_up_logging(debug=False)
ret = run_tests.main(should_overwrite=False, coverage=cov)

cov.stop()

cov.html_report(directory=args.dir, show_contexts=True, skip_empty=True)
print(f"Wrote html to {args.dir}")

sys.exit(ret)
Пример #26
0
def test():
    import run_tests
    run_tests.main([])