[Bf-extensions-cvs] [cb10969e] master: Fixed ant_landscape/test.py so that it can be imported
Sybren A. Stüvel
noreply at git.blender.org
Mon Jun 19 15:22:40 CEST 2017
Commit: cb10969e467adee25fc8ec201a41d7d2fbebfcbf
Author: Sybren A. Stüvel
Date: Mon Jun 19 15:11:46 2017 +0200
Branches: master
https://developer.blender.org/rBAcb10969e467adee25fc8ec201a41d7d2fbebfcbf
Fixed ant_landscape/test.py so that it can be imported
This allows the `bl_load_py_modules.py` unit test to do its job.
===================================================================
M ant_landscape/test.py
===================================================================
diff --git a/ant_landscape/test.py b/ant_landscape/test.py
index 32894a18..d56815f2 100644
--- a/ant_landscape/test.py
+++ b/ant_landscape/test.py
@@ -1,19 +1,21 @@
-from stats import Stats
from numpy import *
-stats = Stats()
-
-a = zeros(10000000)
-print(stats.time())
-print(stats.memory())
-a = sin(a)
-print(stats.time())
-print(stats.memory())
-a = cos(a)
-print(stats.time())
-print(stats.memory())
-a = cos(a)**2+sin(a)**2
-print(stats.time())
-print(stats.memory())
+if __name__ == '__main__':
+ # This only works when this script is loaded as main, or
+ # run directly from the ant_landscape directory.
+ from stats import Stats
+ stats = Stats()
+ a = zeros(10000000)
+ print(stats.time())
+ print(stats.memory())
+ a = sin(a)
+ print(stats.time())
+ print(stats.memory())
+ a = cos(a)
+ print(stats.time())
+ print(stats.memory())
+ a = cos(a)**2+sin(a)**2
+ print(stats.time())
+ print(stats.memory())
More information about the Bf-extensions-cvs
mailing list