Esempio n. 1
0
def run():
    subprocess.check_call('cd ase; git pull -q > git.out', shell=True)
    subprocess.check_call('cd gpaw; git pull -q > git.out', shell=True)
    os.chdir('gpaw')
    sys.path[:0] = [op.join(dir, 'ase'), op.join(dir, 'lib', 'python')]
    subprocess.check_call('python3 setup.py install --home=.. > build.out',
                          shell=True)

    from gpaw import setup_paths
    setup_paths.insert(0, datasets)
    from gpaw.test import TestRunner, tests

    with open('test.out', 'w') as fd:
        os.mkdir('testing')
        os.chdir('testing')
        failed = TestRunner(tests[::-1], fd, jobs=4, show_output=False).run()
        os.chdir('..')

    from ase.test import test
    results = test(calculators=['gpaw'], verbosity=0)
    failed.extend(results.errors + results.failures)

    if failed:
        print(failed, file=sys.stderr)
    else:
        shutil.rmtree('testing')

    os.chdir('..')
    shutil.rmtree('lib')
    shutil.rmtree('bin')
Esempio n. 2
0
def build(email):
    if os.system('svn checkout ' +
                 'https://svn.fysik.dtu.dk/projects/ase/trunk ase') != 0:
        raise RuntimeError('Checkout of ASE failed!')
    os.chdir('ase')
    if os.system('python setup.py install --home=.') != 0:
        raise RuntimeError('Installation failed!')
    sys.path.insert(0, 'lib/python')
    from ase.test import test
    from ase.version import version

    # Run test-suite:
    stream = open('test-results.txt', 'w')
    results = test(verbosity=2, dir='ase/test', display=False, stream=stream)
    stream.close()
    if len(results.failures) > 0 or len(results.errors) > 0:
        address = email
        subject = 'ASE test-suite failed!'
        os.system('mail -s "%s" %s < %s' %
                  (subject, address, 'test-results.txt'))
        raise RuntimeError('Testsuite failed!')

    # Generate tar-file:
    assert os.system('python setup.py sdist') == 0

    if os.system('epydoc --docformat restructuredtext --parse-only ' +
                 '--name ASE ' +
                 '--url http://wiki.fysik.dtu.dk/ase ' +
                 '--show-imports --no-frames -v ase &> epydoc.out') != 0:
        raise RuntimeError('Epydoc failed!')

    epydoc_errors = open('epydoc.out').read()
    if ' Warning:' in epydoc_errors:
        sys.stderr.write(epydoc_errors)

    os.chdir('doc')
    os.mkdir('_build')
    if os.system('PYTHONPATH=%s/ase sphinx-build . _build' % tmpdir) != 0:
        raise RuntimeError('Sphinx failed!')
    os.system('cd _build; cp _static/searchtools.js .; ' +
              'sed -i s/snapshot.tar/%s.tar/ download.html' % version)

    if 1:
        if os.system('PYTHONPATH=%s/ase ' % tmpdir +
                     'sphinx-build -b latex . _build 2> error') != 0:
            raise RuntimeError('Sphinx failed!')
        os.system(
            'grep -v "WARNING: unusable reference target found" error 1>&2')
        
        os.chdir('_build')
        #os.system('cd ../..; ln -s doc/_static')
        if os.system('make ase-manual.pdf 2>&1') != 0:
            raise RuntimeError('pdflatex failed!')
    else:
        os.chdir('_build')

    assert os.system('mv ../../html epydoc;' +
                     'mv ../../dist/python-ase-%s.tar.gz .' % version) == 0
Esempio n. 3
0
def build():
    if os.system('svn checkout ' +
                 'https://svn.fysik.dtu.dk/projects/ase/trunk ase') != 0:
        raise RuntimeError('Checkout of ASE failed!')
    os.chdir('ase')
    if os.system('python setup.py install --home=.') != 0:
        raise RuntimeError('Installation failed!')
    sys.path.insert(0, 'lib/python')
    from ase.test import test
    from ase.version import version

    # Run test-suite:
    stream = open('test-results.txt', 'w')
    results = test(verbosity=2, dir='ase/test', display=False, stream=stream)
    stream.close()
    if len(results.failures) > 0 or len(results.errors) > 0:
        address = '*****@*****.**'
        subject = 'ASE test-suite failed!'
        os.system('mail -s "%s" %s < %s' %
                  (subject, address, 'test-results.txt'))
        raise RuntimeError('Testsuite failed!')

    # Generate tar-file:
    assert os.system('python setup.py sdist') == 0

    if os.system('epydoc --docformat restructuredtext --parse-only ' +
                 '--name ASE ' + '--url http://wiki.fysik.dtu.dk/ase ' +
                 '--show-imports --no-frames -v ase >& epydoc.out') != 0:
        raise RuntimeError('Epydoc failed!')

    epydoc_errors = open('epydoc.out').read()
    if ' Warning:' in epydoc_errors:
        sys.stderr.write(epydoc_errors)

    os.chdir('doc')
    os.mkdir('_build')
    if os.system('PYTHONPATH=%s/ase sphinx-build . _build' % tmpdir) != 0:
        raise RuntimeError('Sphinx failed!')
    os.system('cd _build; cp _static/searchtools.js .; ' +
              'sed -i s/snapshot.tar/%s.tar/ download.html' % version)

    if 1:
        if os.system('PYTHONPATH=%s/ase ' % tmpdir +
                     'sphinx-build -b latex . _build 2> error') != 0:
            raise RuntimeError('Sphinx failed!')
        os.system(
            'grep -v "WARNING: unusable reference target found" error 1>&2')

        os.chdir('_build')
        #os.system('cd ../..; ln -s doc/_static')
        if os.system('make ase-manual.pdf 2>&1') != 0:
            raise RuntimeError('pdflatex failed!')
    else:
        os.chdir('_build')

    assert os.system('mv ../../html epydoc;' +
                     'mv ../../dist/python-ase-%s.tar.gz .' % version) == 0
Esempio n. 4
0
def build():
    if os.system("svn checkout " + "https://svn.fysik.dtu.dk/projects/ase/trunk ase") != 0:
        raise RuntimeError("Checkout of ASE failed!")
    os.chdir("ase")
    if os.system("python setup.py install --home=.") != 0:
        raise RuntimeError("Installation failed!")
    sys.path.insert(0, "lib/python")
    from ase.test import test
    from ase.version import version

    # Run test-suite:
    stream = open("test-results.txt", "w")
    results = test(verbosity=2, dir="ase/test", display=False, stream=stream)
    stream.close()
    if len(results.failures) > 0 or len(results.errors) > 0:
        address = "*****@*****.**"
        subject = "ASE test-suite failed!"
        os.system('mail -s "%s" %s < %s' % (subject, address, "test-results.txt"))
        raise RuntimeError("Testsuite failed!")

    # Generate tar-file:
    assert os.system("python setup.py sdist") == 0

    if (
        os.system(
            "epydoc --docformat restructuredtext --parse-only "
            + "--name ASE "
            + "--url http://wiki.fysik.dtu.dk/ase "
            + "--show-imports --no-frames -v ase >& epydoc.out"
        )
        != 0
    ):
        raise RuntimeError("Epydoc failed!")

    epydoc_errors = open("epydoc.out").read()
    if " Warning:" in epydoc_errors:
        sys.stderr.write(epydoc_errors)

    os.chdir("doc")
    os.mkdir("_build")
    if os.system("PYTHONPATH=%s/ase sphinx-build . _build" % tmpdir) != 0:
        raise RuntimeError("Sphinx failed!")
    os.system("cd _build; cp _static/searchtools.js .; " + "sed -i s/snapshot/%s/g download.html" % version)

    if 1:
        if os.system("PYTHONPATH=%s/ase " % tmpdir + "sphinx-build -b latex . _build 2> error") != 0:
            raise RuntimeError("Sphinx failed!")
        os.system('grep -v "WARNING: unusable reference target found" error 1>&2')

        os.chdir("_build")
        # os.system('cd ../..; ln -s doc/_static')
        if os.system("make ase-manual.pdf 2>&1") != 0:
            raise RuntimeError("pdflatex failed!")
    else:
        os.chdir("_build")

    assert os.system("mv ../../html epydoc;" + "mv ../../dist/python-ase-%s.tar.gz ." % version) == 0
Esempio n. 5
0
def build(email):
    if os.system('svn checkout ' +
                 'https://svn.fysik.dtu.dk/projects/ase/trunk ase') != 0:
        raise RuntimeError('Checkout of ASE failed!')
    os.chdir('ase')
    if os.system('python setup.py install --home=..') != 0:
        raise RuntimeError('Installation failed!')

    # ase installs under lib independently of the platform
    sys.path.insert(0, '%s/lib/python' % tmpdir)

    from ase.test import test
    from ase.version import version

    # Run test-suite:
    stream = open('test-results.txt', 'w')
    results = test(verbosity=2, display=False, stream=stream)
    stream.close()
    if len(results.failures) > 0 or len(results.errors) > 0:
        if email is not None:
            subject = 'ASE %s: test-suite failed!' % str(version)
            os.system('mail -s "%s" %s < %s' %
                      (subject, email, 'test-results.txt'))
        raise RuntimeError('Testsuite failed!')

    # Generate tar-file:
    assert os.system('python setup.py sdist') == 0

    if doc:

        if os.system('epydoc --docformat restructuredtext --parse-only ' +
                     '--name ASE ' +
                     '--url http://wiki.fysik.dtu.dk/ase ' +
                     '--show-imports --no-frames -v ase &> epydoc.out') != 0:
            raise RuntimeError('Epydoc failed!')

        epydoc_errors = open('epydoc.out').read()
        if ' Warning:' in epydoc_errors:
            sys.stderr.write(epydoc_errors)

        epydoc_output = open('epydoc.out').readlines()
        errors = []
        for line in epydoc_output:
            if line[0] == '|' or line[:2] == '+-':
                errors.append(line)
        if errors:
            fd = open('epydoc.errors', 'w')
            fd.write(''.join(errors))
            fd.close()
            if 1 and email is not None:
                x = os.system('mail -s "ASE: EpyDoc errors" %s < epydoc.errors' % email)
                assert x == 0

        os.chdir('doc')
        os.mkdir('_build')
        if os.system('PYTHONPATH=%s/lib/python sphinx-build . _build' % tmpdir) != 0:
            raise RuntimeError('Sphinx failed!')
        os.system('cd _build; cp _static/searchtools.js .; ' +
                  'sed -i s/snapshot.tar/%s.tar/ download.html' % version)

        if 1:
            if os.system('PYTHONPATH=%s/lib/python ' % tmpdir +
                         'sphinx-build -b latex . _build 2> error') != 0:
                raise RuntimeError('Sphinx failed!')
            os.system(
                'grep -v "WARNING: unusable reference target found" error 1>&2')
            
            os.chdir('_build')
            #os.system('cd ../..; ln -s doc/_static')
            if os.system('make ase-manual.pdf 2>&1') != 0:
                raise RuntimeError('pdflatex failed!')
        else:
            os.chdir('_build')

        assert os.system('mv ../../html epydoc;' +
                         'mv ../../dist/python-ase-%s.tar.gz .' % version) == 0
Esempio n. 6
0
def build(email):
    if os.system('svn checkout ' +
                 'https://svn.fysik.dtu.dk/projects/ase/trunk ase') != 0:
        raise RuntimeError('Checkout of ASE failed!')
    os.chdir('ase')
    if os.system('python setup.py install --home=..') != 0:
        raise RuntimeError('Installation failed!')

    # ase installs under lib independently of the platform
    sys.path.insert(0, '%s/lib/python' % tmpdir)

    from ase.test import test
    from ase.version import version

    if 'ASE_CALCULATORS' in os.environ:
        calculators = os.environ['ASE_CALCULATORS'].split(',')
    else:
        calculators = []

    # Run test-suite:
    stream = open('test-results.txt', 'w')
    results = test(verbosity=2,
                   calculators=calculators,
                   display=False,
                   stream=stream)
    stream.close()
    if len(results.failures) > 0 or len(results.errors) > 0:
        if email is not None:
            subject = 'ASE %s: test-suite failed!' % str(version)
            os.system('mail -s "%s" %s < %s' %
                      (subject, email, 'test-results.txt'))
        raise RuntimeError('Testsuite failed!')

    # Generate tar-file:
    assert os.system('python setup.py sdist') == 0

    if doc:

        if os.system('epydoc --docformat restructuredtext --parse-only ' +
                     '--name ASE ' + '--url http://wiki.fysik.dtu.dk/ase ' +
                     '--show-imports --no-frames -v ase &> epydoc.out') != 0:
            raise RuntimeError('Epydoc failed!')

        epydoc_errors = open('epydoc.out').read()
        if ' Warning:' in epydoc_errors:
            sys.stderr.write(epydoc_errors)

        epydoc_output = open('epydoc.out').readlines()
        errors = []
        for line in epydoc_output:
            if line[0] == '|' or line[:2] == '+-':
                errors.append(line)
        if errors:
            fd = open('epydoc.errors', 'w')
            fd.write(''.join(errors))
            fd.close()
            if 1 and email is not None:
                x = os.system(
                    'mail -s "ASE: EpyDoc errors" %s < epydoc.errors' % email)
                assert x == 0

        os.chdir('doc')
        os.mkdir('_build')
        if os.system('PYTHONPATH=%s/lib/python sphinx-build . _build' %
                     tmpdir) != 0:
            raise RuntimeError('Sphinx failed!')
        os.system('cd _build; cp _static/searchtools.js .; ' +
                  'sed -i s/snapshot.tar/%s.tar/ download.html' % version)

        if 1:
            if os.system('PYTHONPATH=%s/lib/python ' % tmpdir +
                         'sphinx-build -b latex . _build 2> error') != 0:
                raise RuntimeError('Sphinx failed!')
            os.system('grep -v "WARNING: unusable reference target found"' +
                      'error 1>&2')
            # Don't serve mixed content:
            assert os.system(
                'cd _build; find -name "*.html" | xargs sed -i ' +
                '"s%http://cdn.mathjax.org%https://cdn.mathjax.org%"') == 0

            os.chdir('_build')
            # os.system('cd ../..; ln -s doc/_static')
            if os.system('make ase-manual.pdf 2>&1') != 0:
                raise RuntimeError('pdflatex failed!')
        else:
            os.chdir('_build')

        assert os.system('mv ../../html epydoc;' +
                         'mv ../../dist/python-ase-%s.tar.gz .' % version) == 0
Esempio n. 7
0
parser = optparse.OptionParser(
    usage='Usage: python -m ase.test [-c calc1,calc2,...]',
    description='Test ASE')

parser.add_option('-c',
                  '--calculators',
                  help='Comma-separated list of calculators to test.')
parser.add_option('-v',
                  '--verbosity',
                  type=int,
                  default=2,
                  metavar='N',
                  help='Use 0, 1 or 2.')
parser.add_option('-g',
                  '--test-also-gui',
                  action='store_true',
                  help='Test also ase-gui.')

opts, args = parser.parse_args()

if opts.calculators:
    calculators = opts.calculators.split(',')
else:
    calculators = []

results = test(display=opts.test_also_gui,
               verbosity=opts.verbosity,
               calculators=calculators)
sys.exit(len(results.errors + results.failures))
Esempio n. 8
0
#!/usr/bin/env python
from sys import argv

display = (len(argv) != 2 or argv[1] != '--no-display')
from ase.test import test

test(2, display=display)
Esempio n. 9
0
import optparse
import sys

from ase.test import test

usage = ('Usage: python -m ase.test [-c calc1,calc2,...] '
         '[test1.py test2.py ...]')
parser = optparse.OptionParser(usage=usage, description='Test ASE')

parser.add_option('-c', '--calculators',
                  help='Comma-separated list of calculators to test.')
parser.add_option('-v', '--verbosity', type=int, default=2, metavar='N',
                  help='Use 0, 1 or 2.')
parser.add_option('-g', '--test-also-gui', action='store_true',
                  help='Test also ase-gui.')

opts, args = parser.parse_args()

if opts.calculators:
    calculators = opts.calculators.split(',')
else:
    calculators = []

results = test(display=opts.test_also_gui,
               verbosity=opts.verbosity,
               calculators=calculators,
               files=args)
sys.exit(len(results.errors + results.failures))
Esempio n. 10
0
#!/usr/bin/env python
from sys import argv
display = (len(argv) != 2 or argv[1] != '--no-display')
from ase.test import test
test(2, display=display)