Running unit tests on the mac fails because PATH is different from Terminal PATH

Bug #591085 reported by Archimedes Trajano
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Java library for Bazaar
New
Undecided
Unassigned

Bug Description

Running unit tests on Eclipse on the mac fails because PATH is different from the Terminal PATH. Is there a better way of calculating the PATH? Should we put in a copy of bzr itself as part of the test resources and execute it if Python is available? (kinda yucky)

Can it be executed in Jython?

Somehow call terminal and get the PATH from there? like bash -c 'which bzr'

Tags: eclipse junit mac

Related branches

Revision history for this message
Archimedes Trajano (trajano) wrote :

The implementation I did was pretty yucky but it seems to move the thing forward so now it will find the executable on the Mac.

  final Process whichProcess = Runtime.getRuntime().exec(
    new String[] { System.getenv("SHELL"), "-lc", "which bzr" });
  final BufferedReader reader = new BufferedReader(new InputStreamReader(
    whichProcess.getInputStream()));
  final String pathLine = reader.readLine();

tags: added: mac
tags: added: eclipse junit
Revision history for this message
Archimedes Trajano (trajano) wrote :
Download full text (9.7 KiB)

Please note that this does not mean that the JUnits passed.

I found that I needed the bzr-xmloutput plugin installed which I didn't and that made me go forward a bit more. Now I got some weird error with the following stack trace. Not sure what to make of it.

org.vcs.bazaar.client.commandline.CommandLineException: bzr: ERROR: exceptions.AttributeError: 'module' object has no attribute 'user_encoding'

Traceback (most recent call last):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/bzrlib/commands.py", line 853, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/bzrlib/commands.py", line 1055, in run_bzr
    ret = run(*run_argv)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/bzrlib/commands.py", line 661, in run_argv_aliases
    return self.run_direct(**all_cmd_args)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/bzrlib/commands.py", line 665, in run_direct
    return self._operation.run_simple(*args, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/bzrlib/cleanup.py", line 122, in run_simple
    self.cleanups, self.func, *args, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/bzrlib/cleanup.py", line 156, in _do_with_cleanups
    result = func(*args, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/bzrlib/commands.py", line 1070, in ignore_pipe
    result = func(*args, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/bzrlib/plugins/xmloutput/xml_errors.py", line 64, in xml_error_handling
    exitcode = report_exception(sys.exc_info(), sys.stderr)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/bzrlib/plugins/xmloutput/xml_errors.py", line 53, in report_exception
    err_file.write(str(XMLError(exc_object)))
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/bzrlib/plugins/xmloutput/xml_errors.py", line 21, in __str__
    xml = '<?xml version="1.0" encoding="%s"?>' % bzrlib.user_encoding
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/bzrlib/lazy_import.py", line 109, in __getattribute__
    return getattr(obj, attr)
AttributeError: 'module' object has no attribute 'user_encoding'

bzr 2.1.2 on python 2.6.5 (Darwin-10.3.0-i386-64bit)
arguments: ['/opt/local/bin/bzr', 'xmlplugins']
encoding: 'UTF-8', fsenc: 'utf-8', lang: 'en_US.UTF-8'
plugins:
  explorer /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/bzrlib/plugins/explorer [1.0.2]
  launchpad /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/bzrlib/plugins/launchpad [2.1.2]
  netrc_credential_store /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2....

Read more...

Revision history for this message
Archimedes Trajano (trajano) wrote :

It appears to be because I am using an older version of bzr-xmloutput 0.8.4 the latest is 0.8.6 which fixes bug #434998. Since I am using the MacPorts distribution it only has up to version 0.8.4 until some creates and updates the the portfile

Revision history for this message
Archimedes Trajano (trajano) wrote :

Updated to 0.8.6. Fixes a lot of the problems now, but I am still getting some test errors in BazaarClientTest and XMLRPCCommandRunnerTest.

Revision history for this message
Guillermo Gonzalez (verterok) wrote :

Hi,

Please try using the latest trunk of bzr-xmloutput (the version string is 0.8.7.dev) which fixes some issues with newer bzr versions.

Regards,

Revision history for this message
Archimedes Trajano (trajano) wrote :

I don't think I can continue to work on this at the moment. Please feel free to close the defect or lower the importance as needed.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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