error running gimp_xcf.test.py in trunk

Bug #1419266 reported by Alvin Penner
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Medium
Alvin Penner

Bug Description

- not related to Bug 1419192, since the missing files are present in trunk.
- running Windows XP, Inkscape trunk rev 13867
- the test output is given below.

- not able to perform this test on Inkscape 0.91, because Gimp is not installed on that machine
- this test error does not seem to affect the normal usage of the GIMP XCF export routine, which appears to be working properly.

..........................................................................

C:\InkscapeBZR\inkscape\share\extensions\test>gimp_xcf.test.py
test_empty_file (__main__.GimpXCFBasicTest) ... This extension requires at least
 one non empty layer.
ok
test_empty_layer_file (__main__.GimpXCFBasicTest) ... This extension requires at
 least one non empty layer.
ok
test_expected_file (__main__.GimpXCFBasicTest) ... An error occurred while proce
ssing the XCF file.
ERROR

======================================================================
ERROR: test_expected_file (__main__.GimpXCFBasicTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\InkscapeBZR\inkscape\share\extensions\test\gimp_xcf.test.py", line 28
, in test_expected_file
    e.affect(args, False)
  File "..\inkex.py", line 268, in affect
    self.effect()
  File "..\gimp_xcf.py", line 261, in effect
    raise GimpXCFScriptFuError
GimpXCFScriptFuError

----------------------------------------------------------------------
Ran 3 tests in 20.656s

FAILED (errors=1)

su_v (suv-lp)
tags: added: build extensions-plugins
Revision history for this message
su_v (suv-lp) wrote :

Reproduced with Inkscape 0.91+devel on OS X 10.7.5 (AFAIR this error occurred always since I started to run 'make check' on OS X - after bug #1204445 was fixed in trunk). GIMP 2.8.14 is installed and found in $PATH, and export to GIMP XCF works as expected when used from within Inkscape trunk.

Console log on OS X:

>> Testing gimp_xcf
test_empty_file (__main__.GimpXCFBasicTest) ... This extension requires at least one non empty layer.
ok
test_empty_layer_file (__main__.GimpXCFBasicTest) ... This extension requires at least one non empty layer.
ok
test_expected_file (__main__.GimpXCFBasicTest) ... An error occurred while processing the XCF file.
ERROR

======================================================================
ERROR: test_expected_file (__main__.GimpXCFBasicTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "gimp_xcf.test.py", line 28, in test_expected_file
    e.affect(args, False)
  File "../inkex.py", line 268, in affect
    self.effect()
  File "../gimp_xcf.py", line 261, in effect
    raise GimpXCFScriptFuError
GimpXCFScriptFuError

----------------------------------------------------------------------
Ran 3 tests in 7.407s

FAILED (errors=1)

Changed in inkscape:
status: New → Confirmed
Revision history for this message
Alvin Penner (apenner) wrote :

there is a difference between the temporary file name that is used when running the xcf test routine and the temporary file name used when running the Gimp XCF export from inside Inkscape. I put a line of tracing code into gimp_xcf.py at line 182 to print out the temporary file name, xcf. The line of new code looks like this:

xcf = os.path.join(self.tmp_dir, "%s.xcf" % docname)
inkex.errormsg("\nxcf = " + xcf + "\n")

When I run the xcf export from within Inkscape, I get the popup message that says:

xcf = c:\docume~1\alvin\locals~1\temp\tmplk12z_\myxcftest.xcf.xcf
In this case the original svg filename was myxcftest.svg. This export works properly.

When I run the gimp_xcf.test.py file from DOS I get the DOS console printout that says:

xcf = c:\docume~1\alvin\locals~1\temp\tmp6atmh2\Nouveau document 1.xcf
This procedure leads to an error.

perhaps the change in file extension from '.xcf.xcf' to '.xcf' is causing a problem.

Revision history for this message
Alvin Penner (apenner) wrote :

sorry, the file name with the extension .xcf.xcf is not the issue. The real issue is further upstream. When I run this from inside Inkscape using Save As, then it creates a temporary folder and it creates two files in this folder, called "junk_from_gimp.txt" and "layer1.png". When I run this as a test file from DOS, then it creates a temporary folder as before, and the file "junk_from_gimp.txt", but it does not create the file "layer1.png". This eventually leads to a crash since the file does not exist.

Revision history for this message
Alvin Penner (apenner) wrote :

Well it turns out the solution was simple in my case. I had previously set Gimp to be in the Path variable, because this is mandatory to run the xcf export routine, but I had not explicitly set Inkscape to be in the path. As soon as I set the path variable to include Inkscape, using the command:

path=%path%;C:\InkscapeBZR\inkscape

then the test runs correctly, output below.

Not entirely sure whether to mark this as Invalid or not.

..................................................

C:\InkscapeBZR\inkscape\share\extensions\test>gimp_xcf.test.py
test_empty_file (__main__.GimpXCFBasicTest) ... This extension requires at least one non empty layer.
ok
test_empty_layer_file (__main__.GimpXCFBasicTest) ... This extension requires at least one non empty layer.
ok
test_expected_file (__main__.GimpXCFBasicTest) ... ok

----------------------------------------------------------------------
Ran 3 tests in 21.000s

OK

Revision history for this message
Alvin Penner (apenner) wrote :

attached is a proposed modified version of gimp_xcf.py. It will raise an Inkscape-specific error message if the inkscape installation is not found. Hopefully this will make the diagnosis simpler if it occurs, since the previous error message was not very informative.

Revision history for this message
su_v (suv-lp) wrote :

On 2015-02-09 22:44 (+0100), Alvin Penner wrote:
> but I had not explicitly set Inkscape to be in the path. As soon as I
> set the path variable to include Inkscape (...) then the test runs
> correctly, output below.

Confirmed on OS X 10.7.5: extending $PATH so that it includes the path to an installed inkscape binary fixed the test (without any further changes to the extension script and test script):

>> Testing gimp_xcf
test_empty_file (__main__.GimpXCFBasicTest) ... This extension requires at least one non empty layer.
ok
test_empty_layer_file (__main__.GimpXCFBasicTest) ... This extension requires at least one non empty layer.
ok
test_expected_file (__main__.GimpXCFBasicTest) ... ok

----------------------------------------------------------------------
Ran 3 tests in 10.167s

OK

Changed in inkscape:
importance: Undecided → Low
status: Confirmed → Triaged
Revision history for this message
su_v (suv-lp) wrote :

Raising to 'Medium' - unit tests are important.

Changed in inkscape:
importance: Low → Medium
Revision history for this message
su_v (suv-lp) wrote :

JFTR - the buildbots for the trunk PPA expose the same test failure, e.g.
https://launchpadlibrarian.net/197076522/buildlog_ubuntu-utopic-amd64.inkscape-trunk_1%3A0.91.0%2Bdevel%2B13910%2B54~ubuntu14.10.1_UPLOADING.txt.gz

>> Testing gimp_xcf
test_empty_file (__main__.GimpXCFBasicTest) ... This extension requires at least one non empty layer.
ok
test_empty_layer_file (__main__.GimpXCFBasicTest) ... This extension requires at least one non empty layer.
ok
test_expected_file (__main__.GimpXCFBasicTest) ... An error occurred while processing the XCF file.
ERROR

======================================================================
ERROR: test_expected_file (__main__.GimpXCFBasicTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "gimp_xcf.test.py", line 28, in test_expected_file
    e.affect(args, False)
  File "../inkex.py", line 268, in affect
    self.effect()
  File "../gimp_xcf.py", line 261, in effect
    raise GimpXCFScriptFuError
GimpXCFScriptFuError

----------------------------------------------------------------------
Ran 3 tests in 4.262s

FAILED (errors=1

Revision history for this message
su_v (suv-lp) wrote :

Attaching diff based on modified script from comment 5 for easier review.

Revision history for this message
Alvin Penner (apenner) wrote :

any objections if I commit the change proposed in comment 5?
I know it does not solve the original problem, but it yields more precise information as to what the source of the problem is.

Revision history for this message
su_v (suv-lp) wrote :

@JazzyNico - IIRC you wrote the unittests for the gimp output extension, any thoughts?

Revision history for this message
jazzynico (jazzynico) wrote :

> any objections if I commit the change proposed in comment 5?

No objection, feel free to commit.

I wonder if it would be correct to disable the "test_expected_file" test if Inkscape or Gimp is not in the path so that the test doesn't fail. Instead, we could write a message to warn testers that the Gimp extension test can't be fully run.

Revision history for this message
Alvin Penner (apenner) wrote :

thanks, comment 5 committed to rev 13916.

Revision history for this message
Alvin Penner (apenner) wrote :

fwiw, attached is a list of other Python extensions that probably would fail, or should fail, in a similar way if we were to try to create test routines for them. These are routines that attempt to open a new instance of Inkscape using Popen:

dimension.py, generate-voronoi.py, guillotine.py, jessyInk_export.py, perspective.py, restack.py, summersnight.py, synfig_prepare.py, text_extract.py, text_merge.py, webslicer_export.py.

The test routines for perspective.py, restack.py, summersnight.py actually do exist and do not fail, but that is only because the tests are not sufficiently realistic, do not actually execute any significant code.

The file jessyInk_export.py is interesting because it contains a routine called 'findInkscapeCommand' which attempts to find inkscape by searching a few standard locations. However it would fail on my development machine.

I guess what I'm saying is it might be worthwhile to have a fairly generic warning up front in the test procedure to indicate that it is necessary to have Inkscape in the path, since this is not unique to gimp_xcf.py

su_v (suv-lp)
tags: added: backport-proposed
Changed in inkscape:
assignee: nobody → Alvin Penner (apenner)
milestone: none → 0.92
status: Triaged → Fix Committed
Revision history for this message
su_v (suv-lp) wrote :

On 2015-02-11 16:17 (+0100), Alvin Penner wrote:
> it might be worthwhile to have a fairly generic warning up front in
> the test procedure to indicate that it is necessary to have Inkscape
> in the path, since this is not unique to gimp_xcf.py

--> changing bug status to 'In Progress'.

Changed in inkscape:
status: Fix Committed → In Progress
Revision history for this message
jazzynico (jazzynico) wrote :

Follow-up report: Bug #1589202 "Warn users that Inkscape must be in the path when testing Python extensions".

Changed in inkscape:
status: In Progress → Fix Committed
Revision history for this message
Martin Owens (doctormo) wrote :

Can't backport if the issue is still in progress.

tags: removed: backport-proposed
Revision history for this message
Martin Owens (doctormo) wrote :

Addendum: The other bug report should be backport-proposed and this one is already in 0.92.

Bryce Harrington (bryce)
Changed in inkscape:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.