Skip to content
This repository has been archived by the owner on Dec 24, 2019. It is now read-only.

python -m unittest discover mathml_to_image_service - Unit Test Not Passed #24

Open
priya4075 opened this issue Mar 21, 2017 · 3 comments

Comments

@priya4075
Copy link

After Building the Flask server & svgtex .. I got the below error . Kindly help me to proceed further to get an proper output

(Flask) PS C:\mathml-to-image-service> python -m unittest discover mathml_to_image_service
F.....[2017-03-21 14:37:37,093] ERROR in app: Exception on / [POST]
Traceback (most recent call last):
File "C:\mathml-to-image-service\mathml_to_image_service\Flask\lib\site-packages\flask\app.py", line 1982, in wsgi_app

response = self.full_dispatch_request()
File "C:\mathml-to-image-service\mathml_to_image_service\Flask\lib\site-packages\flask\app.py", line 1614, in full_dis
patch_request
rv = self.handle_user_exception(e)
File "C:\mathml-to-image-service\mathml_to_image_service\Flask\lib\site-packages\flask\app.py", line 1517, in handle_u
ser_exception
reraise(exc_type, exc_value, tb)
File "C:\mathml-to-image-service\mathml_to_image_service\Flask\lib\site-packages\flask_compat.py", line 33, in rerais
e
raise value
File "C:\mathml-to-image-service\mathml_to_image_service\Flask\lib\site-packages\flask\app.py", line 1612, in full_dis
patch_request
rv = self.dispatch_request()
File "C:\mathml-to-image-service\mathml_to_image_service\Flask\lib\site-packages\flask\app.py", line 1598, in dispatch
_request
return self.view_functionsrule.endpoint
File "C:\mathml-to-image-service\mathml_to_image_service\service.py", line 30, in convert
file_name = to_image(svg_string, format, int(max_size), int(quality))
File "C:\mathml-to-image-service\mathml_to_image_service\svg_to_image.py", line 127, in to_image
stderr=subprocess.DEVNULL)
File "c:\program files\python36\Lib\subprocess.py", line 286, in check_call
retcode = call(*popenargs, **kwargs)
File "c:\program files\python36\Lib\subprocess.py", line 267, in call
with Popen(*popenargs, **kwargs) as p:
File "c:\program files\python36\Lib\subprocess.py", line 707, in init
restore_signals, start_new_session)
File "c:\program files\python36\Lib\subprocess.py", line 990, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
E.EEEEEE

ERROR: test_root_path_post_redirect_to_image (tests.test_service.FlaskrTestCase)

Traceback (most recent call last):
File "C:\mathml-to-image-service\mathml_to_image_service\tests\test_service.py", line 50, in test_root_path_post_redir
ect_to_image
data = json.loads(response.data.decode('utf-8'))
File "c:\program files\python36\Lib\json_init_.py", line 354, in loads
return _default_decoder.decode(s)
File "c:\program files\python36\Lib\json\decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "c:\program files\python36\Lib\json\decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

======================================================================
ERROR: test_create_image (tests.test_svg_to_image.SVGToImageTestCase)

Traceback (most recent call last):
File "C:\mathml-to-image-service\mathml_to_image_service\tests\test_svg_to_image.py", line 14, in test_create_image
filename = to_image(svg, 'gif', 200)
File "C:\mathml-to-image-service\mathml_to_image_service\svg_to_image.py", line 127, in to_image
stderr=subprocess.DEVNULL)
File "c:\program files\python36\Lib\subprocess.py", line 286, in check_call
retcode = call(*popenargs, **kwargs)
File "c:\program files\python36\Lib\subprocess.py", line 267, in call
with Popen(*popenargs, **kwargs) as p:
File "c:\program files\python36\Lib\subprocess.py", line 707, in init
restore_signals, start_new_session)
File "c:\program files\python36\Lib\subprocess.py", line 990, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

======================================================================
ERROR: test_create_image_bad_svg (tests.test_svg_to_image.SVGToImageTestCase)

Traceback (most recent call last):
File "C:\mathml-to-image-service\mathml_to_image_service\tests\test_svg_to_image.py", line 23, in test_create_image_ba
d_svg
filename = to_image(svg, 'png', 200)
File "C:\mathml-to-image-service\mathml_to_image_service\svg_to_image.py", line 127, in to_image
stderr=subprocess.DEVNULL)
File "c:\program files\python36\Lib\subprocess.py", line 286, in check_call
retcode = call(*popenargs, **kwargs)
File "c:\program files\python36\Lib\subprocess.py", line 267, in call
with Popen(*popenargs, **kwargs) as p:
File "c:\program files\python36\Lib\subprocess.py", line 707, in init
restore_signals, start_new_session)
File "c:\program files\python36\Lib\subprocess.py", line 990, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

======================================================================
ERROR: test_create_quality_1_gif (tests.test_svg_to_image.SVGToImageTestCase)

Traceback (most recent call last):
File "C:\mathml-to-image-service\mathml_to_image_service\tests\test_svg_to_image.py", line 66, in test_create_quality_
1_gif
filename = to_image(svg, 'gif', 200, 1)
File "C:\mathml-to-image-service\mathml_to_image_service\svg_to_image.py", line 127, in to_image
stderr=subprocess.DEVNULL)
File "c:\program files\python36\Lib\subprocess.py", line 286, in check_call
retcode = call(*popenargs, **kwargs)
File "c:\program files\python36\Lib\subprocess.py", line 267, in call
with Popen(*popenargs, **kwargs) as p:
File "c:\program files\python36\Lib\subprocess.py", line 707, in init
restore_signals, start_new_session)
File "c:\program files\python36\Lib\subprocess.py", line 990, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

======================================================================
ERROR: test_create_quality_1_png (tests.test_svg_to_image.SVGToImageTestCase)

Traceback (most recent call last):
File "C:\mathml-to-image-service\mathml_to_image_service\tests\test_svg_to_image.py", line 50, in test_create_quality_
1_png
filename = to_image(svg, 'png', 200, 1)
File "C:\mathml-to-image-service\mathml_to_image_service\svg_to_image.py", line 127, in to_image
stderr=subprocess.DEVNULL)
File "c:\program files\python36\Lib\subprocess.py", line 286, in check_call
retcode = call(*popenargs, **kwargs)
File "c:\program files\python36\Lib\subprocess.py", line 267, in call
with Popen(*popenargs, **kwargs) as p:
File "c:\program files\python36\Lib\subprocess.py", line 707, in init
restore_signals, start_new_session)
File "c:\program files\python36\Lib\subprocess.py", line 990, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

======================================================================
ERROR: test_create_quality_2_gif (tests.test_svg_to_image.SVGToImageTestCase)

Traceback (most recent call last):
File "C:\mathml-to-image-service\mathml_to_image_service\tests\test_svg_to_image.py", line 58, in test_create_quality_
2_gif
filename = to_image(svg, 'gif', 200, 2)
File "C:\mathml-to-image-service\mathml_to_image_service\svg_to_image.py", line 127, in to_image
stderr=subprocess.DEVNULL)
File "c:\program files\python36\Lib\subprocess.py", line 286, in check_call
retcode = call(*popenargs, **kwargs)
File "c:\program files\python36\Lib\subprocess.py", line 267, in call
with Popen(*popenargs, **kwargs) as p:
File "c:\program files\python36\Lib\subprocess.py", line 707, in init
restore_signals, start_new_session)
File "c:\program files\python36\Lib\subprocess.py", line 990, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

======================================================================
ERROR: test_create_quality_2_png (tests.test_svg_to_image.SVGToImageTestCase)

Traceback (most recent call last):
File "C:\mathml-to-image-service\mathml_to_image_service\tests\test_svg_to_image.py", line 42, in test_create_quality_
2_png
filename = to_image(svg, 'png', 200, 2)
File "C:\mathml-to-image-service\mathml_to_image_service\svg_to_image.py", line 127, in to_image
stderr=subprocess.DEVNULL)
File "c:\program files\python36\Lib\subprocess.py", line 286, in check_call
retcode = call(*popenargs, **kwargs)
File "c:\program files\python36\Lib\subprocess.py", line 267, in call
with Popen(*popenargs, **kwargs) as p:
File "c:\program files\python36\Lib\subprocess.py", line 707, in init
restore_signals, start_new_session)
File "c:\program files\python36\Lib\subprocess.py", line 990, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

======================================================================
FAIL: test_basic_encode (tests.test_mathoid_client.MathoidTestCase)

Traceback (most recent call last):
File "C:\mathml-to-image-service\mathml_to_image_service\tests\test_mathoid_client.py", line 16, in test_basic_encode
self.assertEqual(get_svg(self.mml), self.svg)
AssertionError: '<svg[39 chars]ink" width="28.74ex" height="6.009ex" viewBox=[10979 chars]svg>' != '<svg[39 chars]ink" s
tyle="width: 28.125ex; height: 5.375ex; [11091 chars]svg>'
Diff is 22261 characters long. Set self.maxDiff to None to see it.

Ran 14 tests in 4.051s

FAILED (failures=1, errors=7)

@rudigiesler
Copy link
Owner

@priya4075 This service delegates a fair amount of the work out to other services, specifically the rsvg-convert, convert, and pngcrush. The tests are complaining that it cannot find those executables.

I am not sure if those tools are available in Windows, or what is involved in getting python to be able to see them (possibly adding them to the PATH).

Unfortunately I only have experience with, and this software is only tested with linux systems, so there are no guarantees that it will work on Windows, but we welcome pull requests if there are things that need to be changed to make it work on different platforms, as long as it doesn't break functionality on linux systems.

@priya4075
Copy link
Author

error

This error only i am getting.
I am passing this mathml.
limn→∞ ln(12n+2−9+4n)=ln3

I am trying in Windows 7 OS.
Flask server is getting initiated. Just Help me to get an output properly.

@rudigiesler
Copy link
Owner

rudigiesler commented Apr 11, 2017

@priya4075 This seems to be an error returned directly from svgtex.

That means that everything is probably set up and running well on the mathml-to-image-service side.

To confirm, you can try accessing svgtex directly (by default localhost:16000), type your mathml in there, and see the result that you get.

If you get the same result, then it's an issue with svgtex not understanding the mathml that you've sent it. If not, then it's possibly an issue with the way that mathml-to-image-service is sending the mathml to svgtex, and we can look into that.

Also, maybe try the mathml presented in the docs: http://mathml-to-image-service.readthedocs.io/en/latest/getting_started.html#using-the-api , and see if that works.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants