Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8795633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:25:54+00:00 2026-06-13T23:25:54+00:00

I’m trying to use pytest on Jython. And I’m getting stuck right at the

  • 0

I’m trying to use pytest on Jython. And I’m getting stuck right at the beginning.

I’ve successfully installed the pytest package with easy_install:

$ ./jython easy_install pytest

When I try to run example from this page, things go wrong. I receive an extremely long failure report, like the one bellow. Does anybody have any idea why this is happening?

py.test-jython

============================= test session starts ==============================
platform java1.6.0_37 — Python 2.5.3 — pytest-2.3.2
collected 1 items

test_sample.py F

=================================== FAILURES ===================================
_________________ test_answer __________________

def test_answer():
  assert func(3) == 5

test_sample.py:5:


self = AssertionError()

def __init__(self, *args):
    BuiltinAssertionError.__init__(self, *args)
    if args:
        try:
            self.msg = str(args[0])
        except py.builtin._sysex:
            raise
        except:
            self.msg = "<[broken __repr__] %s at %0xd>" %(
                args[0].__class__, id(args[0]))
    else:
        f = py.code.Frame(sys._getframe(1))
        try:
            source = f.code.fullsource
            if source is not None:
                try:
                    source = source.getstatement(f.lineno, assertion=True)
                except IndexError:
                    source = None
                else:
                    source = str(source.deindent()).strip()
        except py.error.ENOENT:
            source = None
            # this can also occur during reinterpretation, when the
            # co_filename is set to "<run>".
        if source:
          self.msg = reinterpret(source, f, should_fail=True)

../jython2.5.3/Lib/site-packages/pytest-2.3.2-py2.5.egg/_pytest/assertion/reinterpret.py:32:


source = ‘assert func(3) == 5’, frame =
should_fail = True

def interpret(source, frame, should_fail=False):
    mod = ast.parse(source)
    visitor = DebugInterpreter(frame)
    try:
      visitor.visit(mod)

../jython2.5.3/Lib/site-packages/pytest-2.3.2-py2.5.egg/_pytest/assertion/newinterpret.py:49:


.
.
.


self = <_pytest.assertion.newinterpret.DebugInterpreter object at 0x4>
name = Name

def visit_Name(self, name):
  explanation, result = self.generic_visit(name)

../jython2.5.3/Lib/site-packages/pytest-2.3.2-py2.5.egg/_pytest/assertion/newinterpret.py:147:


self = <_pytest.assertion.newinterpret.DebugInterpreter object at 0x4>
node = Name

def generic_visit(self, node):
    # Fallback when we don't have a special implementation.
    if _is_ast_expr(node):
        mod = ast.Expression(node)
        co = self._compile(mod)
        try:
            result = self.frame.eval(co)
        except Exception:
            raise Failure()
        explanation = self.frame.repr(result)
        return explanation, result
    elif _is_ast_stmt(node):
        mod = ast.Module([node])
        co = self._compile(mod, "exec")
        try:
            self.frame.exec_(co)
        except Exception:
            raise Failure()
        return None, None
    else:
      raise AssertionError("can't handle %s" %(node,))

E AssertionError: can’t handle Name

../jython2.5.3/Lib/site-packages/pytest-2.3.2-py2.5.egg/_pytest/assertion/newinterpret.py:134: AssertionError
=========================== 1 failed in 0.55 seconds ===========================

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T23:25:55+00:00Added an answer on June 13, 2026 at 11:25 pm

    Pytest has a workaround for jython’s lacking AST implementation, see issue1479. I just extended the workaround on the pytest side to work on jython-2.5.3. You can install a dev-candidate of pytest with:

    pip install -i http://pypi.testrun.org -U pytest
    

    and should get at least version 2.3.4.dev1 with “py.test-jython –version” and get assertions working with jython-2.5.3.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I am trying to render a haml file in a javascript response like so:
I want use html5's new tag to play a wav file (currently only supported
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.