[TIP] Testing Flask apps in a pyvenv environment :p:
Thomas C. Hicks
paradox at pobox.com
Thu Jul 9 00:18:28 PDT 2015
On 07/09/2015 01:08 PM, Randy Syring wrote:
>> Is there a reason py.test can't find the flask module in the pyvenv
>> created virtual environment?
> Are you sure you are using py.test from your virtualenv and not from
> the system? Run `py.test --version` to help with this:
>> (foo)rsyring at loftex:~$ py.test --version
>> This is pytest version 2.7.1, imported from
>> setuptools registered plugins:
>> pytest-cov-1.8.1 at
Exactly the problem, thanks for the pointer! All nice green passing
>> AssertionError: b'Hello, World!' != 'Hello, World!'
> Notice the "b" prefix on the first string. You are getting hung up by
> the fact that one is a byte-string and the other is a unicode string.
I made this same mistake in another project (turns out you can't render
Chinese characters with Weasyprint as easily as just putting them in the
text!). Eventually I will learn.
More information about the testing-in-python