Skip to content

Commit

Permalink
fixed test management commands
Browse files Browse the repository at this point in the history
  • Loading branch information
vdboor committed Jan 22, 2018
1 parent f7c9df9 commit f84e732
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
4 changes: 2 additions & 2 deletions example/pexp/management/commands/p2cmd.py
Expand Up @@ -7,7 +7,7 @@
import time
from pprint import pprint
from random import Random
from django.core.management.base import NoArgsCommand
from django.core.management import BaseCommand
from django.db import connection

from pexp.models import *
Expand Down Expand Up @@ -46,7 +46,7 @@ def wrapper(*arg):
return wrapper


class Command(NoArgsCommand):
class Command(BaseCommand):
help = ""

def handle_noargs(self, **options):
Expand Down
12 changes: 5 additions & 7 deletions example/pexp/management/commands/polybench.py
Expand Up @@ -6,7 +6,7 @@
import time
import sys

from django.core.management.base import NoArgsCommand
from django.core.management import BaseCommand
from django.db import connection
from pprint import pprint
from pexp.models import *
Expand Down Expand Up @@ -60,7 +60,7 @@ def run_vanilla_any_poly(func, iterations=1):
# benchmarks

def bench_create(model):
for i in xrange(num_objects):
for i in range(num_objects):
model.objects.create(field1='abc' + str(i), field2='abcd' + str(i), field3='abcde' + str(i))
# print 'count:',model.objects.count()

Expand All @@ -71,7 +71,7 @@ def bench_load1(model):


def bench_load1_short(model):
for i in xrange(num_objects / 100):
for i in range(num_objects / 100):
for o in model.objects.all()[:100]:
pass

Expand All @@ -84,7 +84,7 @@ def bench_load2(model):


def bench_load2_short(model):
for i in xrange(num_objects / 100):
for i in range(num_objects / 100):
for o in model.objects.all()[:100]:
f1 = o.field1
f2 = o.field2
Expand All @@ -98,7 +98,7 @@ def bench_delete(model):
# Command


class Command(NoArgsCommand):
class Command(BaseCommand):
help = ""

def handle_noargs(self, **options):
Expand All @@ -112,5 +112,3 @@ def handle_noargs(self, **options):
]
for f, iterations in func_list:
run_vanilla_any_poly(f, iterations=iterations)

print
Expand Up @@ -3,18 +3,17 @@
This module is a scratchpad for general development, testing & debugging
"""

from django.core.management.base import NoArgsCommand
from django.core.management import BaseCommand

from pexp.models import *


class Command(NoArgsCommand):
class Command(BaseCommand):
help = ""

def handle_noargs(self, **options):
Project.objects.all().delete()
o = Project.objects.create(topic="John's gathering")
o = ArtProject.objects.create(topic="Sculpting with Tim", artist="T. Turner")
o = ResearchProject.objects.create(topic="Swallow Aerodynamics", supervisor="Dr. Winter")
print Project.objects.all()
print
print(Project.objects.all())

0 comments on commit f84e732

Please sign in to comment.