-
-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'martinal/topic-unicode-preparations'
- Loading branch information
Showing
90 changed files
with
1,587 additions
and
1,584 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
[flake8] | ||
ignore = E501,E226 | ||
ignore = E501,E226,W503,E127,E123,E128,E265 | ||
exclude = .git,__pycache__,doc/sphinx/source/conf.py,build,dist,test |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,31 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from __future__ import print_function | ||
|
||
__authors__ = "Martin Sandve Alnæs" | ||
__date__ = "2008-09-28 -- 2008-09-28" | ||
|
||
import os | ||
import pytest | ||
from ufl.algorithms import load_ufl_file, validate_form | ||
from ufl.algorithms import load_ufl_file, compute_form_data, validate_form | ||
from glob import glob | ||
|
||
# Taken from | ||
# http://ivory.idyll.org/blog/mar-07/replacing-commands-with-subprocess | ||
from subprocess import Popen, PIPE, STDOUT | ||
|
||
|
||
def get_status_output(cmd, input=None, cwd=None, env=None): | ||
pipe = Popen(cmd, shell=True, cwd=cwd, env=env, stdout=PIPE, stderr=STDOUT) | ||
(output, errout) = pipe.communicate(input=input) | ||
assert not errout | ||
status = pipe.returncode | ||
return (status, output) | ||
|
||
|
||
def _test_all_demos(): | ||
# Check all at once | ||
skip = set(glob("../demo/_*.ufl")) | ||
filenames = [f for f in sorted(glob("../demo/*.ufl")) if not f in skip] | ||
cmd = "ufl-analyse %s" % " ".join(filenames) | ||
status, output = get_status_output(cmd) | ||
assert status == 0 | ||
demodir = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "demo")) | ||
|
||
|
||
def get_demo_filenames(): | ||
skiplist = glob("../demo/_*.ufl") # + ["../demo/Hyperelasticity3D.ufl"] | ||
filenames = [] | ||
for f in sorted(glob("../demo/*.ufl")): | ||
if f in skiplist: | ||
print(("Skipping demo %s" % f)) | ||
else: | ||
filenames.append(f) | ||
filenames = sorted( | ||
set(glob(os.path.join(demodir, "*.ufl"))) | ||
- set(glob(os.path.join(demodir, "_*.ufl"))) | ||
) | ||
return filenames | ||
|
||
|
||
def xtest_each_demo_with_ufl_analyse(): | ||
"Check each file from cmdline with ufl-analyse." | ||
for f in get_demo_filenames(): | ||
cmd = "ufl-analyse %s" % f | ||
status, output = get_status_output(cmd) | ||
assert status == 0 | ||
if status == 0: | ||
print(("Successfully analysed %s without problems" % f)) | ||
else: | ||
name = "%s.analysis" % f | ||
print(("Encountered problems when analysing %s " | ||
"(return code %s), see output in file %s" % (f, status, name))) | ||
of = open(name, "w") | ||
of.write(output) | ||
of.close() | ||
print() | ||
print(output) | ||
print() | ||
|
||
|
||
def test_each_demo_with_validate_form(): | ||
@pytest.mark.parametrize("filename", get_demo_filenames()) | ||
def test_demo_files(filename): | ||
"Check each form in each file with validate_form." | ||
for filename in get_demo_filenames(): | ||
print(filename) | ||
data = load_ufl_file(filename) | ||
for form in data.forms: | ||
try: | ||
validate_form(form) | ||
excepted = 0 | ||
except: | ||
excepted = 1 | ||
assert excepted == 0, filename | ||
data = load_ufl_file(filename) | ||
for form in data.forms: | ||
#fd = compute_form_data(form) # TODO: Skip failure examples | ||
validate_form(form) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.