FAQ — Frequently asked questions¶
I get ImportError: No module named htf
¶
Your copy of HILSTER Testing Framework is not installed. Read installation instructions and install it.
Check your $PYTHONPATH
environment variable. It must include the path
where the HILSTER Testing Framework installation is located. $PYTHONPATH
is a list of
paths where the python interpreter searches for python modules.
Paths are separated by ;
on Windows and :
on Linux.
I get UnicodeDecodeError
¶
By default all printed characters must be within 0 and 127.
Some special characters are greater than 127 so that UnicodeDecodeError
is raised.
Solution:
You should deal with unicode wherever possible. In Python 3 all strings are
unicode by default. Python 2.7 offers this possibility by importing the __future__
module.
Add a line # -*- coding: utf-8 -*-
to your file header, and a line
from __future__ import absolute_import, division, print_function, unicode_literals
to save the file in UTF-8 format. This way you also write code that is compatible with
Python 2.7 and 3.
Once __future__.unicode_literals
is imported all strings "string
and all docstrings are unicode by default.
If you don’t want to use the __future__
module, you can force a unicode-string
with u"
but be aware that docstrings are not unicode and special characters might
lead to errors or might be ignored in test reports.
For example
u"Umlauts: ÄÖÜäöü"
is a valid unicode string that
does not lead to a UnicodeDecodeError
.