Permalink
Browse files

Remove convertToUnicode as Houdini is much better with things now.

Play around with using coverage for ht.inline tests.
  • Loading branch information...
captainhammy committed Sep 13, 2018
1 parent 719e2e3 commit 0d4ebd27ad127ef364eeba17c5e8d578928efb02
Showing with 35 additions and 39 deletions.
  1. +3 −6 python/ht/houdini/package.py
  2. +0 −29 python/ht/utils.py
  3. +32 −4 python/tests/inline/test_inline.py
@@ -21,9 +21,6 @@
# Third Party Imports
from mechanize import Browser, LinkNotFoundError
# Houdini Toolbox Imports
import ht.utils
# =============================================================================
# GLOBALS
# =============================================================================
@@ -841,7 +838,7 @@ def __init__(self):
with open(config_path) as handle:
# Get the json data.
data = json.load(handle, object_hook=ht.utils.convertFromUnicode)
data = json.load(handle)
# Construct settings objects for available data.
self._environment = HoudiniEnvironmentSettings(
@@ -864,7 +861,7 @@ def __init__(self):
)
with open(build_config_path) as handle:
data = json.load(handle, object_hook=ht.utils.convertFromUnicode)
data = json.load(handle)
self._build_data = HoudiniBuildData(data)
@@ -1092,7 +1089,7 @@ def _getSESIAuthInfo():
)
with open(auth_path) as handle:
data = json.load(handle, object_hook=ht.utils.convertFromUnicode)
data = json.load(handle)
return data["username"], data["password"]
View
@@ -12,35 +12,6 @@
# FUNCTIONS
# =============================================================================
def convertFromUnicode(data):
"""Convert any unicode members to normal strings."""
# If the data is a dictionary we need to convert the key/value pairs
# and return a new dictionary.
if isinstance(data, dict):
return {convertFromUnicode(key): convertFromUnicode(value)
for key, value in data.iteritems()}
# Python 2.6 compatible workaround for no dictionary comprehensions.
# return dict(
# [
# (convertFromUnicode(key), convertFromUnicode(value))
# for key, value in data.iteritems()
# ]
# )
# Convert any elements in a list.
elif isinstance(data, list):
return [convertFromUnicode(element) for element in data]
# The data is a unicode string, so encode it to a regular one.
elif isinstance(data, unicode):
return data.encode('utf-8')
# Return the untouched data.
return data
@contextlib.contextmanager
def timer(label=None):
"""Context manager for outputting timing information.
@@ -1,4 +1,4 @@
#!/usr/bin/python
#! /usr/bin/env hython
"""This script is a unit test suite for the inline.py module.
It can be executed directly from the command line, or directly using python or
@@ -9,17 +9,31 @@
"""
# Standard Library Imports
# =============================================================================
# IMPORTS
# =============================================================================
# Python Imports
import coverage
import datetime
import os
import sys
import unittest
# Houdini Imports
import ht.inline
import hou
# =============================================================================
# GLOBALS
# =============================================================================
OBJ = hou.node("/obj")
# =============================================================================
# FUNCTIONS
# =============================================================================
def getObjGeo(nodePath):
"""Get the geometry from the display node of a Geometry object."""
return OBJ.node(nodePath).displayNode().geometry()
@@ -2056,6 +2070,8 @@ def test_isDummy(self):
# Destroy the dummy definition.
node_type.definition().destroy()
# =============================================================================
if __name__ == '__main__':
# Load the testing hip file.
try:
@@ -2065,6 +2081,18 @@ def test_isDummy(self):
except hou.LoadWarning:
pass
cov = coverage.Coverage(source=["ht.inline"])
cov.start()
import ht.inline
# Run the tests.
unittest.main()
try:
unittest.main()
finally:
cov.stop()
cov.save()
cov.html_report()

0 comments on commit 0d4ebd2

Please sign in to comment.