-
Notifications
You must be signed in to change notification settings - Fork 38
Description
When using log.subpath, https://slash.readthedocs.io/en/master/configuration.html#conf-log-subpath, formatting isn't working as I would expect, specifically when trying to trim strings. For example, in .slashrc, set the following to create a session id folder, and within it, folders named after the test class for each test:
slash.config.root.log.subpath = "/".join([
"{context.session.id}",
"{context.test_classname:.3}",
"debug.log"
])
I would expect that the test class name would be trimmed to just 3 characters, and be used as the parent folder name of debug.log
Instead, we get this error: "Session error caught -- <Error: TypeError: unsupported format string passed to _NormalizedObject.format>"
If we omit the ":.3" part, everything works fine.
I believe this is because we're relying on object's default format method:
Line 33 in b505dc0
| class _NormalizedObject(object): |
It would be ideal to be able to trim these, since in Windows, long path names can play a role in whether we are or are not successful at creating these paths. Especially since the test class name or even the test method name can be any arbitrary length. Limiting the number of characters helps me to identify the appropriate test for which this log belongs, while also respecting a finite number of characters in the folder structure.