Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing is broken on windows_x86 platform #3422

Closed
prototypicalpro opened this issue Mar 16, 2020 · 1 comment
Closed

Testing is broken on windows_x86 platform #3422

prototypicalpro opened this issue Mar 16, 2020 · 1 comment
Labels
Milestone

Comments

@prototypicalpro
Copy link

prototypicalpro commented Mar 16, 2020

Configuration

Operating system:
Windows 10 10.0.18363

PlatformIO Version (platformio --version):
4.2.1 (Latest)

Description of problem

When attempting to execute local testing with the windows_x86 platform an error is thrown:

Error: Traceback (most recent call last):
  File "c:\users\noah\.platformio\penv\lib\site-packages\platformio\__main__.py", line 102, in main
    cli()  # pylint: disable=no-value-for-parameter
  File "c:\users\noah\.platformio\penv\lib\site-packages\click\core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "c:\users\noah\.platformio\penv\lib\site-packages\click\core.py", line 782, in main
    rv = self.invoke(ctx)
  File "c:\users\noah\.platformio\penv\lib\site-packages\platformio\commands\__init__.py", line 44, in invoke        
    return super(PlatformioCLI, self).invoke(ctx)
  File "c:\users\noah\.platformio\penv\lib\site-packages\click\core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\users\noah\.platformio\penv\lib\site-packages\click\core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\users\noah\.platformio\penv\lib\site-packages\click\core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "c:\users\noah\.platformio\penv\lib\site-packages\click\decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "c:\users\noah\.platformio\penv\lib\site-packages\platformio\commands\test\command.py", line 170, in cli      
    "succeeded": tp.process(),
  File "c:\users\noah\.platformio\penv\lib\site-packages\platformio\commands\test\embedded.py", line 35, in process  
    if not self.build_or_upload(target):
  File "c:\users\noah\.platformio\penv\lib\site-packages\platformio\commands\test\processor.py", line 106, in build_or_upload
    self.generate_outputcpp(
  File "c:\users\noah\.platformio\penv\lib\site-packages\platformio\commands\test\processor.py", line 194, in generate_outputcpp
    tpl = Template(cpp_tpl).substitute(TRANSPORT_OPTIONS[self.get_transport()])
  File "c:\users\noah\.platformio\penv\lib\site-packages\platformio\commands\test\processor.py", line 92, in get_transport
    if transport not in TRANSPORT_OPTIONS:
UnboundLocalError: local variable 'transport' referenced before assignment

Looking at where this error is coming from, it looks like support for testing with windows_x86 simply wasn't added:

def get_transport(self):
if self.env_options.get("platform") == "native":
transport = "native"
elif "framework" in self.env_options:
transport = self.env_options.get("framework")[0]
if "test_transport" in self.env_options:
transport = self.env_options["test_transport"]
if transport not in TRANSPORT_OPTIONS:
raise exception.PlatformioException(
"Unknown Unit Test transport `%s`" % transport
)
return transport.lower()
I should note that by switching to the native platform and installing gcc/g++ into my path, I am able to test just fine.

Steps to Reproduce

  1. Given a testable project, add the following lines to your platformio.ini:
[env:native]
platform = windows_x86
  1. Click test in the platformio IDE, or run platformio test.
  2. Device tests should run fine, but tests on the windows platform will throw the error shown above.

Let me know if you need more information.

@ivankravets ivankravets added this to the 4.3.0 milestone Mar 16, 2020
@ivankravets
Copy link
Member

Thanks for the report!

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

No branches or pull requests

2 participants