Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSybren A. Stüvel <sybren@stuvel.eu>2017-06-19 16:11:46 +0300
committerSybren A. Stüvel <sybren@stuvel.eu>2017-06-19 16:11:46 +0300
commitcb10969e467adee25fc8ec201a41d7d2fbebfcbf (patch)
tree8b90391f37f5ac15a1399a85501223cebe062236 /ant_landscape
parent7bd475449f020e776fffba62f5c4b2ae0dca1d7c (diff)
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.
Diffstat (limited to 'ant_landscape')
-rw-r--r--ant_landscape/test.py32
1 files changed, 17 insertions, 15 deletions
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())