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

Error when adding a called nested function inside of a test method #82

Open
jmvrbanac opened this issue Jun 14, 2016 · 0 comments
Open
Labels

Comments

@jmvrbanac
Copy link
Owner

This doesn't happen for all nested functions; however, it does in this specific case:

Example:

    def my_test(self):
        something = []
        def faux_info(x):
            something.append(x)

        logger = stub(info=faux_info)
        logger.info('my thing')

        expect(something[0]).to.equal('something')

Will result in the following stacktrace:

Traceback (most recent call last):
  File "/home/john/.virtualenvs/ark-metering/bin/specter", line 11, in <module>
    sys.exit(activate())
  File "/home/john/.virtualenvs/ark-metering/lib/python3.4/site-packages/specter/runner.py", line 197, in activate
    runner.run(args)
  File "/home/john/.virtualenvs/ark-metering/lib/python3.4/site-packages/specter/runner.py", line 171, in run
    select_tests=self.arguments.select_tests)
  File "/home/john/.virtualenvs/ark-metering/lib/python3.4/site-packages/specter/spec.py", line 398, in execute
    self.standard_execution(select_metadata, select_tests)
  File "/home/john/.virtualenvs/ark-metering/lib/python3.4/site-packages/specter/spec.py", line 364, in standard_execution
    self.top_parent.dispatch(TestEvent(case))
  File "/home/john/.virtualenvs/ark-metering/lib/python3.4/site-packages/pyevents/manager.py", line 58, in dispatch
    listener.callback(event)
  File "/home/john/.virtualenvs/ark-metering/lib/python3.4/site-packages/specter/reporting/console.py", line 121, in test_complete
    self.output_test_case_result(test_case, level)
  File "/home/john/.virtualenvs/ark-metering/lib/python3.4/site-packages/specter/reporting/console.py", line 110, in output_test_case_result
    self.use_unicode
  File "/home/john/.virtualenvs/ark-metering/lib/python3.4/site-packages/specter/reporting/utils.py", line 116, in print_expects
    expect_msg = u'{mark} {msg}'.format(mark=mark, msg=expect)
  File "/home/john/.virtualenvs/ark-metering/lib/python3.4/site-packages/specter/expect.py", line 175, in __str__
    action_list[0] = self.target_src_param or str(self.target)
  File "/home/john/.virtualenvs/ark-metering/lib/python3.4/site-packages/specter/expect.py", line 33, in target_src_param
    if self.src_params and self.src_params.expect_arg:
  File "/home/john/.virtualenvs/ark-metering/lib/python3.4/site-packages/specter/util.py", line 73, in expect_arg
    if self.expect_call:
  File "/home/john/.virtualenvs/ark-metering/lib/python3.4/site-packages/specter/util.py", line 53, in expect_call
    return self.cmp_call.func.value.value
AttributeError: 'Name' object has no attribute 'value'
@jmvrbanac jmvrbanac added the bug label Jun 14, 2016
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

1 participant