import os
import re
import socket
-import sys
import typing
import unittest
import urllib.parse
class SetCookieDeprecatedArgs(RequestHandler):
def get(self):
# Mixed case is supported, but deprecated
- self.set_cookie("a", "b", HttpOnly=True, pATH="/foo")
+ with ignore_deprecation():
+ self.set_cookie("a", "b", HttpOnly=True, pATH="/foo")
return [
("/set", SetCookieHandler),
self.assertEqual(headers[2], "c=1; HttpOnly; Path=/")
self.assertEqual(headers[3], "d=1; Path=/")
- @unittest.skipIf(
- getattr(sys.flags, "context_aware_warnings", False),
- "interaction with context-aware warnings is buggy",
- )
def test_set_cookie_deprecated(self):
- with ignore_deprecation():
- response = self.fetch("/set_deprecated")
+ response = self.fetch("/set_deprecated")
header = response.headers.get("Set-Cookie")
self.assertEqual(header, "a=b; HttpOnly; Path=/foo")