Skip to content

Commit

Permalink
rename included 'memory' to 'resource'
Browse files Browse the repository at this point in the history
  • Loading branch information
thraxil committed May 5, 2016
1 parent 11befc1 commit 93beac1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion expvar/vars.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def value(self):


class MemoryExpVar(ExpVar):
name = "memory"
name = "resource"

def value(self):
memstats = resource.getrusage(resource.RUSAGE_SELF)
Expand Down
14 changes: 7 additions & 7 deletions testapp/main/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ def test_cmdline(self):
self.assertIn('cmdline', d)


class MemoryTest(TestCase):
def test_memory(self):
class ResourceTest(TestCase):
def test_resource(self):
r = self.client.get(reverse('expvar'))
d = json.loads(smart_str(r.content))
self.assertIn('memory', d)
m = d['memory']
self.assertIn('resource', d)
m = d['resource']
for f in MEM_FIELDS:
self.assertIn(f, m)

Expand All @@ -59,11 +59,11 @@ def test_main_expvar(self):


class ExtendTest(TestCase):
def test_memory(self):
def test_resource(self):
r = self.client.get(reverse('expvar'))
d = json.loads(smart_str(r.content))
self.assertIn('memory', d)
m = d['memory']
self.assertIn('resource', d)
m = d['resource']
self.assertIn('New', m)
self.assertEqual(m['New'], 78)

Expand Down
2 changes: 1 addition & 1 deletion testapp/main/vars.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class PlainExpVar(expvar.ExpVar):


class ExtendMemory(expvar.ExpVar):
name = "memory"
name = "resource"

def value(self):
return {"New": 78}
Expand Down

0 comments on commit 93beac1

Please sign in to comment.