import sys
import os
sys.path.insert(1, os.path.join("..","..",".."))
import h2o
from h2o.exceptions import H2OServerError
from tests import pyunit_utils


def trace_request():
    err = None
    try:
        h2o.api("TRACE /")
    except H2OServerError as e:
        err = e

    assert err is not None
    assert str(err.message).startswith("HTTP 405 Method Not Allowed")


if __name__ == "__main__":
    pyunit_utils.standalone_test(trace_request)
else:
    trace_request()

import sys, os
sys.path.insert(1, os.path.join("..", "..", "..", "h2o-py"))
import h2o
from h2o.exceptions import H2OServerError
from tests import pyunit_utils


def trace_request():
    err = None
    try:
        h2o.api("TRACE /")
    except H2OServerError as e:
        err = e

    msg = str(err.message)

    assert err is not None
    print("<Error message>")
    print(msg)
    print("</Error Message>")

    # exact message depends on Jetty Version
    assert (msg.startswith("HTTP 500") and "TRACE method is not supported" in msg) or \
           msg.startswith("HTTP 405 Method Not Allowed")


if __name__ == "__main__":
    pyunit_utils.standalone_test(trace_request)
else:
    trace_request()

Fix TRACE test also in rel-yau
Fix TRACE test also in rel-yau

- import sys
+ import sys, os
- import os
- sys.path.insert(1, os.path.join("..","..",".."))
+ sys.path.insert(1, os.path.join("..", "..", "..", "h2o-py"))
  import h2o
  from h2o.exceptions import H2OServerError
  from tests import pyunit_utils
  
  
  def trace_request():
      err = None
      try:
          h2o.api("TRACE /")
      except H2OServerError as e:
          err = e
  
+     msg = str(err.message)
+ 
      assert err is not None
+     print("<Error message>")
+     print(msg)
+     print("</Error Message>")
+ 
+     # exact message depends on Jetty Version
+     assert (msg.startswith("HTTP 500") and "TRACE method is not supported" in msg) or \
-     assert str(err.message).startswith("HTTP 405 Method Not Allowed")
+            msg.startswith("HTTP 405 Method Not Allowed")
  
  
  if __name__ == "__main__":
      pyunit_utils.standalone_test(trace_request)
  else:
      trace_request()
  
Fix TRACE test also in rel-yau
## Code Before:
import sys
import os
sys.path.insert(1, os.path.join("..","..",".."))
import h2o
from h2o.exceptions import H2OServerError
from tests import pyunit_utils


def trace_request():
    err = None
    try:
        h2o.api("TRACE /")
    except H2OServerError as e:
        err = e

    assert err is not None
    assert str(err.message).startswith("HTTP 405 Method Not Allowed")


if __name__ == "__main__":
    pyunit_utils.standalone_test(trace_request)
else:
    trace_request()

## Instruction:
Fix TRACE test also in rel-yau
## Code After:
import sys, os
sys.path.insert(1, os.path.join("..", "..", "..", "h2o-py"))
import h2o
from h2o.exceptions import H2OServerError
from tests import pyunit_utils


def trace_request():
    err = None
    try:
        h2o.api("TRACE /")
    except H2OServerError as e:
        err = e

    msg = str(err.message)

    assert err is not None
    print("<Error message>")
    print(msg)
    print("</Error Message>")

    # exact message depends on Jetty Version
    assert (msg.startswith("HTTP 500") and "TRACE method is not supported" in msg) or \
           msg.startswith("HTTP 405 Method Not Allowed")


if __name__ == "__main__":
    pyunit_utils.standalone_test(trace_request)
else:
    trace_request()
