From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id C45851381F3 for ; Mon, 3 Jun 2013 07:05:44 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 45CB5E0990; Mon, 3 Jun 2013 07:05:44 +0000 (UTC) Received: from mail-bk0-f43.google.com (mail-bk0-f43.google.com [209.85.214.43]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 40564E0990 for ; Mon, 3 Jun 2013 07:05:42 +0000 (UTC) Received: by mail-bk0-f43.google.com with SMTP id jm19so644018bkc.2 for ; Mon, 03 Jun 2013 00:05:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:user-agent:references:in-reply-to:mime-version :content-type:content-transfer-encoding:message-id; bh=dwqXjpWBiQJZhoIJvVNTASXnMoVi/1yti0oftndAAzw=; b=tgtrOVcK0FGHdNLTbEqKKPYT7Zolb/pBREyw6redp4jDNEyOJrkIZblvAynjmIAqwN 56n6doT72QzJcXKOGMXpr73KWee3Orb8CkHJG7tvOUIqi2X2atvt/kFN2Md6CAdbA2ZW AU8TDPk94sl6fJg+jBpz6iwksjwN73PwWxdp/eUSzHWypcx7DAlO8VzD7SrCgXsGDe4u kkA0oSxzAZ/76okH4o61eoyH4qbY8LUMMk+ablZe3xAHn5ranIyiC4A/BQMxeFJm2yX3 0wHxzO08APFF9bMJimXYtp6k/CbmckyXMhFRRM6v0r1SsZSfJZrxGMgUfgt36kuYWPD6 77BA== X-Received: by 10.204.166.133 with SMTP id m5mr6124968bky.78.1370243141582; Mon, 03 Jun 2013 00:05:41 -0700 (PDT) Received: from afta-picea.localnet (110-143-251-94.net.stream.pl. [94.251.143.110]) by mx.google.com with ESMTPSA id v6sm19202026bko.3.2013.06.03.00.05.40 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 03 Jun 2013 00:05:40 -0700 (PDT) From: Arfrever Frehtes Taifersar Arahesis To: gentoo-python@lists.gentoo.org Subject: Re: [gentoo-python] recent trend of django-foo tests Date: Mon, 3 Jun 2013 09:05:04 +0200 User-Agent: KMail (GNU/Linux) References: <20130520170533.462ab085@archtester.homenetwork> <20130521013616.694f7026@archtester.homenetwork> In-Reply-To: Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Discussions centering around the Python ecosystem in Gentoo Linux X-BeenThere: gentoo-python@gentoo.org X-BeenThere: gentoo-python@lists.gentoo.org MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart2407599.39MHQO5IE1"; protocol="application/pgp-signature"; micalg=pgp-sha512 Content-Transfer-Encoding: 7bit Message-Id: <201306030905.07511.Arfrever.FTA@gmail.com> X-Archives-Salt: 082a0a09-1526-4566-85bd-f3a5c78d4819 X-Archives-Hash: 58a28857e166b284f4a776f34503cc78 --nextPart2407599.39MHQO5IE1 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 2013-05-30 21:34 Mike Gilbert napisa=C5=82(a): > python -c "code" foo.py does NOT run foo.py. $ cat my_script #!/usr/bin/python import sys import unittest class SomeTests(unittest.TestCase): def test_something(self): self.assertTrue(sys.something > 0) if __name__ =3D=3D "__main__": unittest.main(verbosity=3D2) $ diff -u my_script my_module.py $ python my_script test_something (__main__.SomeTests) ... ERROR =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D ERROR: test_something (__main__.SomeTests) =2D--------------------------------------------------------------------- Traceback (most recent call last): File "my_script", line 8, in test_something self.assertTrue(sys.something > 0) AttributeError: 'module' object has no attribute 'something' =2D--------------------------------------------------------------------- Ran 1 test in 0.001s =46AILED (errors=3D1) $ python -m my_module test_something (__main__.SomeTests) ... ERROR =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D ERROR: test_something (__main__.SomeTests) =2D--------------------------------------------------------------------- Traceback (most recent call last): File "./my_module.py", line 8, in test_something self.assertTrue(sys.something > 0) AttributeError: 'module' object has no attribute 'something' =2D--------------------------------------------------------------------- Ran 1 test in 0.001s =46AILED (errors=3D1) $ python -c 'import runpy, sys; sys.something=3D1; runpy.run_path("my_scrip= t", run_name=3D"__main__")' test_something (__main__.SomeTests) ... ok =2D--------------------------------------------------------------------- Ran 1 test in 0.000s OK $ python -c 'import runpy, sys; sys.something=3D1; runpy.run_module("my_mod= ule", run_name=3D"__main__", alter_sys=3DTrue)' test_something (__main__.SomeTests) ... ok =2D--------------------------------------------------------------------- Ran 1 test in 0.000s OK $ :) =2D- Arfrever Frehtes Taifersar Arahesis --nextPart2407599.39MHQO5IE1 Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (GNU/Linux) iQIcBAABCgAGBQJRrEAjAAoJEMyxswy68gDOm54P/RbExiVwdF7P5FPRllLuGOkD xo3U1ks+Yc41F7umkjyWmGARBX5jUb5Cl8VVhwZrMErt34bh/ITU5v4MRlw0ouCi SgnqSv4rUv4VAQcY0BNTW5+mBq3kOSpwOPd0xi9ODxYGIlhxJySvU4XkKt6U5erc IvjsxGpmHqdouijrY2zXipUQCpnobiGTsOsMFSq35xcP9MHesZ7jL0x+kWhnwBv1 DlbGK8zfe5xlhoHisBe1p1vvN5/vYbpfSDVEKKmhHxwwJUBjdaWXujPR6ki4JXM7 Z2qu7cgu275LqQ2pgx1KdH8kzTgrv0MFiZpRXZibtm4PfoHK3QwBFrKuhnYKGcYS qhAke9jU5aTRmI7igfb7Au1EPb10WhNggfvv8ewh8TqeI1oJnp4i01McU1CbtCDp SfWfWGp2QPYO4xpT5ExmU6DPMOslL6hQaZN2TMmA/7fnRZt3lq7bZCQ2amSiDIgP hrpAkYfaNB0ilgMJLHKFTaQEMFNVLQiDVwRj38gLuGQw7D37Q3soDYvt6AK52Q1T 63R1PebSR9zHVUwGdfcBYZmvISH3sRGPtxKP3/7br+rNE2c+jyMzy7cHw1fjOr5C WtFDGUljEm7dBxRQYJ5nZyZ9vE51ImQWYvVxodGVGngxSuP0H7REcEpYZeGZ5LRa HbQoBYPj9iKNytA03GXX =kj+u -----END PGP SIGNATURE----- --nextPart2407599.39MHQO5IE1--