You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The errors are (running pytest -k "test_load__type" --log-level DEBUG for example):
===============================================================================FAILURES================================================================================______________________________________________________________________TestMethods.test_load__type______________________________________________________________________args= (<pycaching.trackable.Trackableobjectat0x7f71f85f8cd0>,), kwargs= {}, self=<pycaching.trackable.Trackableobjectat0x7f71f85f8cd0>
@functools.wraps(func)
defwrapper(*args, **kwargs):
self=args[0]
try:
>returnfunc(*args, **kwargs)
pycaching/util.py:30:
_____________________________________________________________________________________self=<pycaching.trackable.Trackableobjectat0x7f71f85f8cd0>
@property@lazy_loadeddeftype(self):
"""The trackable type. A type depends on the trackable icon. It can be either "Travel Bug Dog Tag" or specific geocoin name, eg. "Adventure Race Hracholusky 2015 Geocoin". :type: :class:`str` """>returnself._typeEAttributeError: 'Trackable'objecthasnoattribute'_type'pycaching/trackable.py:152: AttributeErrorDuringhandlingoftheaboveexception, anotherexceptionoccurred:
self=<test.test_trackable.TestMethodstestMethod=test_load__type>deftest_load__type(self):
withself.subTest("existing"):
trackable=Trackable(self.gc, "TB1KEZ9")
withself.recorder.use_cassette("trackable_load__existing_type"):
>self.assertEqual("SwedenHawk Geocoin", trackable.type)
test/test_trackable.py:92:
_____________________________________________________________________________________pycaching/util.py:33: inwrapperself.load()
_____________________________________________________________________________________self=<pycaching.trackable.Trackableobjectat0x7f71f85f8cd0>defload(self):
"""Load all possible details about the trackable. .. note:: This method is called automatically when you access a property which isn't yet filled in (so-called "lazy loading"). You don't have to call it explicitly. :raise .LoadError: If trackable loading fails (probably because of not existing trackable). """# pick url based on what info we have right nowifhasattr(self, "url"):
url=self.urlelifhasattr(self, "_tid"):
url="track/details.aspx?tracker={}".format(self._tid)
else:
raiseerrors.LoadError("Trackable lacks info for loading")
# make requestroot=self.geocaching._request(url)
# parse dataself.tid=root.find("span", "CoordInfoCode").textself.name=root.find(id="ctl00_ContentBody_lbHeading").textself.type=root.find(id="ctl00_ContentBody_BugTypeImage").get("alt")
self.owner=root.find(id="ctl00_ContentBody_BugDetails_BugOwner").textself.goal=root.find(id="TrackableGoal").textself.description=root.find(id="TrackableDetails").text>self._kml_url=root.find(id="ctl00_ContentBody_lnkGoogleKML").get("href")
EAttributeError: 'NoneType'objecthasnoattribute'get'pycaching/trackable.py:196: AttributeError
Debugging this yields the result that the login is successful, but the trackable page is rendered as logged-out user, thus not containing the KML data.
Disabling the setup cassette loader in this class seems to fix this issue, although it is now clear to me why:
@classmethoddefsetUpClass(cls):
super().setUpClass()
cls.t=Trackable(cls.gc, "TB1KEZ9")
# with cls.recorder.use_cassette("trackable_setup"):# cls.t.load()
We should do some more investigation on what actually causes this issue/side effect and fix it.
The text was updated successfully, but these errors were encountered:
This does not seem to be limited to the trackable cassette, but occurred for test.test_cache.TestMethods as well, which has a similar setUpClass overwrite.
FriedrichFroebel
changed the title
Cassette recording failure for tests.test_trackable.TestMethods
Cassette recording failure for tests which extend setUpClass
Aug 22, 2022
Recording a new cassette for the following test fails inside
tests.test_trackable.TestMethods
(for #185):The errors are (running
pytest -k "test_load__type" --log-level DEBUG
for example):Debugging this yields the result that the login is successful, but the trackable page is rendered as logged-out user, thus not containing the KML data.
Disabling the setup cassette loader in this class seems to fix this issue, although it is now clear to me why:
We should do some more investigation on what actually causes this issue/side effect and fix it.
The text was updated successfully, but these errors were encountered: