1. Shu Zong Chen
  2. fakeos

Commits

Comments (0)

Files changed (3)

File fakeos/fakefs.py Added

View file
  • Ignore whitespace
  • Hide word diff
+
+
+_DATA = {}
+
+def get_file(fn):
+	return _DATA[fn]
+
+def set_file(fn, data):
+	_DATA[fn] = data

File fakeos/fakeos.py Added

View file
  • Ignore whitespace
  • Hide word diff
+import os as _os
+
+class os(object):
+	pass
+
+os.name = _os.name
+os.environ = _os.environ

File test.py Added

View file
  • Ignore whitespace
  • Hide word diff
+from fakeos import os, open
+
+with open('fish.txt') as fh:
+	print fh.read()
+