Skip to content

MAINT: Bail out more gracefully if profile data isn't present #1459

Description

@HaoZeke

Currently loading a benchmark without profile data present and checking for it raises, which could well be a user warning instead.

File ~/Git/Github/asvWork/asv/asv/results.py:564, in Results.get_profile(self, benchmark_name)
    549 """
    550 Get the profile data for the given benchmark name.
    551 
   (...)
    561 
    562 """
    563 profile_data = self._profiles[benchmark_name]
--> 564 profile_data = profile_data.encode('ascii')
    565 profile_bytes = zlib.decompress(base64.b64decode(profile_data))
    566 return profile_bytes

AttributeError: 'NoneType' object has no attribute 'encode'

In [64]: b1.get_profile('benchmarks.TimeSuite.time_add_arr')

Doesn't really matter but still, a better error / warning would be nicer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions