diff --git a/tests/README b/tests/README
new file mode 100644
index 0000000000000000000000000000000000000000..ef00705712030f7af4f6d37a484fdb9170812916
--- /dev/null
+++ b/tests/README
@@ -0,0 +1,4 @@
+This directory contains tests for various functionality areas of MicroPython.
+To run all stable tests, run "run-tests" script in this directory. Note
+that bytecode tests are not yet stable and should be run separately in
+"bytecode" subdirectory.
diff --git a/tests/basics/tests/0prelim.py b/tests/basics/0prelim.py
similarity index 100%
rename from tests/basics/tests/0prelim.py
rename to tests/basics/0prelim.py
diff --git a/tests/basics/tests/builtin-len1.py b/tests/basics/builtin-len1.py
similarity index 100%
rename from tests/basics/tests/builtin-len1.py
rename to tests/basics/builtin-len1.py
diff --git a/tests/basics/tests/class-subclass-builtin.py b/tests/basics/class-subclass-builtin.py
similarity index 100%
rename from tests/basics/tests/class-subclass-builtin.py
rename to tests/basics/class-subclass-builtin.py
diff --git a/tests/basics/tests/class1.py b/tests/basics/class1.py
similarity index 100%
rename from tests/basics/tests/class1.py
rename to tests/basics/class1.py
diff --git a/tests/basics/tests/class2.py b/tests/basics/class2.py
similarity index 100%
rename from tests/basics/tests/class2.py
rename to tests/basics/class2.py
diff --git a/tests/basics/tests/class3.py b/tests/basics/class3.py
similarity index 100%
rename from tests/basics/tests/class3.py
rename to tests/basics/class3.py
diff --git a/tests/basics/tests/class_inherit1.py b/tests/basics/class_inherit1.py
similarity index 100%
rename from tests/basics/tests/class_inherit1.py
rename to tests/basics/class_inherit1.py
diff --git a/tests/basics/tests/class_item.py b/tests/basics/class_item.py
similarity index 100%
rename from tests/basics/tests/class_item.py
rename to tests/basics/class_item.py
diff --git a/tests/basics/tests/class_number.py b/tests/basics/class_number.py
similarity index 100%
rename from tests/basics/tests/class_number.py
rename to tests/basics/class_number.py
diff --git a/tests/basics/tests/class_store.py b/tests/basics/class_store.py
similarity index 100%
rename from tests/basics/tests/class_store.py
rename to tests/basics/class_store.py
diff --git a/tests/basics/tests/closure1.py b/tests/basics/closure1.py
similarity index 100%
rename from tests/basics/tests/closure1.py
rename to tests/basics/closure1.py
diff --git a/tests/basics/tests/closure2.py b/tests/basics/closure2.py
similarity index 100%
rename from tests/basics/tests/closure2.py
rename to tests/basics/closure2.py
diff --git a/tests/basics/tests/comprehension1.py b/tests/basics/comprehension1.py
similarity index 100%
rename from tests/basics/tests/comprehension1.py
rename to tests/basics/comprehension1.py
diff --git a/tests/basics/tests/containment.py b/tests/basics/containment.py
similarity index 100%
rename from tests/basics/tests/containment.py
rename to tests/basics/containment.py
diff --git a/tests/basics/tests/dict1.py b/tests/basics/dict1.py
similarity index 100%
rename from tests/basics/tests/dict1.py
rename to tests/basics/dict1.py
diff --git a/tests/basics/tests/dict2.py b/tests/basics/dict2.py
similarity index 100%
rename from tests/basics/tests/dict2.py
rename to tests/basics/dict2.py
diff --git a/tests/basics/tests/dict_clear.py b/tests/basics/dict_clear.py
similarity index 100%
rename from tests/basics/tests/dict_clear.py
rename to tests/basics/dict_clear.py
diff --git a/tests/basics/tests/dict_copy.py b/tests/basics/dict_copy.py
similarity index 100%
rename from tests/basics/tests/dict_copy.py
rename to tests/basics/dict_copy.py
diff --git a/tests/basics/tests/dict_fromkeys.py b/tests/basics/dict_fromkeys.py
similarity index 100%
rename from tests/basics/tests/dict_fromkeys.py
rename to tests/basics/dict_fromkeys.py
diff --git a/tests/basics/tests/dict_get.py b/tests/basics/dict_get.py
similarity index 100%
rename from tests/basics/tests/dict_get.py
rename to tests/basics/dict_get.py
diff --git a/tests/basics/tests/dict_iterator.py b/tests/basics/dict_iterator.py
similarity index 100%
rename from tests/basics/tests/dict_iterator.py
rename to tests/basics/dict_iterator.py
diff --git a/tests/basics/tests/dict_pop.py b/tests/basics/dict_pop.py
similarity index 100%
rename from tests/basics/tests/dict_pop.py
rename to tests/basics/dict_pop.py
diff --git a/tests/basics/tests/dict_popitem.py b/tests/basics/dict_popitem.py
similarity index 100%
rename from tests/basics/tests/dict_popitem.py
rename to tests/basics/dict_popitem.py
diff --git a/tests/basics/tests/dict_setdefault.py b/tests/basics/dict_setdefault.py
similarity index 100%
rename from tests/basics/tests/dict_setdefault.py
rename to tests/basics/dict_setdefault.py
diff --git a/tests/basics/tests/dict_update.py b/tests/basics/dict_update.py
similarity index 100%
rename from tests/basics/tests/dict_update.py
rename to tests/basics/dict_update.py
diff --git a/tests/basics/tests/dict_views.py b/tests/basics/dict_views.py
similarity index 100%
rename from tests/basics/tests/dict_views.py
rename to tests/basics/dict_views.py
diff --git a/tests/basics/tests/enumerate.py b/tests/basics/enumerate.py
similarity index 100%
rename from tests/basics/tests/enumerate.py
rename to tests/basics/enumerate.py
diff --git a/tests/basics/tests/eval1.py b/tests/basics/eval1.py
similarity index 100%
rename from tests/basics/tests/eval1.py
rename to tests/basics/eval1.py
diff --git a/tests/basics/tests/exception1.py b/tests/basics/exception1.py
similarity index 100%
rename from tests/basics/tests/exception1.py
rename to tests/basics/exception1.py
diff --git a/tests/basics/tests/filter.py b/tests/basics/filter.py
similarity index 100%
rename from tests/basics/tests/filter.py
rename to tests/basics/filter.py
diff --git a/tests/basics/tests/float1.py b/tests/basics/float1.py
similarity index 100%
rename from tests/basics/tests/float1.py
rename to tests/basics/float1.py
diff --git a/tests/basics/tests/for1.py b/tests/basics/for1.py
similarity index 100%
rename from tests/basics/tests/for1.py
rename to tests/basics/for1.py
diff --git a/tests/basics/tests/fun1.py b/tests/basics/fun1.py
similarity index 100%
rename from tests/basics/tests/fun1.py
rename to tests/basics/fun1.py
diff --git a/tests/basics/tests/fun2.py b/tests/basics/fun2.py
similarity index 100%
rename from tests/basics/tests/fun2.py
rename to tests/basics/fun2.py
diff --git a/tests/basics/tests/fun3.py b/tests/basics/fun3.py
similarity index 100%
rename from tests/basics/tests/fun3.py
rename to tests/basics/fun3.py
diff --git a/tests/basics/tests/generator1.py b/tests/basics/generator1.py
similarity index 100%
rename from tests/basics/tests/generator1.py
rename to tests/basics/generator1.py
diff --git a/tests/basics/tests/generator2.py b/tests/basics/generator2.py
similarity index 100%
rename from tests/basics/tests/generator2.py
rename to tests/basics/generator2.py
diff --git a/tests/basics/tests/import1a.py b/tests/basics/import1a.py
similarity index 100%
rename from tests/basics/tests/import1a.py
rename to tests/basics/import1a.py
diff --git a/tests/basics/tests/import1b.py b/tests/basics/import1b.py
similarity index 100%
rename from tests/basics/tests/import1b.py
rename to tests/basics/import1b.py
diff --git a/tests/basics/tests/int-small.py b/tests/basics/int-small.py
similarity index 100%
rename from tests/basics/tests/int-small.py
rename to tests/basics/int-small.py
diff --git a/tests/basics/tests/int1.py b/tests/basics/int1.py
similarity index 100%
rename from tests/basics/tests/int1.py
rename to tests/basics/int1.py
diff --git a/tests/basics/tests/is-isnot.py b/tests/basics/is-isnot.py
similarity index 100%
rename from tests/basics/tests/is-isnot.py
rename to tests/basics/is-isnot.py
diff --git a/tests/basics/tests/lambda1.py b/tests/basics/lambda1.py
similarity index 100%
rename from tests/basics/tests/lambda1.py
rename to tests/basics/lambda1.py
diff --git a/tests/basics/tests/list1.py b/tests/basics/list1.py
similarity index 100%
rename from tests/basics/tests/list1.py
rename to tests/basics/list1.py
diff --git a/tests/basics/tests/list_clear.py b/tests/basics/list_clear.py
similarity index 100%
rename from tests/basics/tests/list_clear.py
rename to tests/basics/list_clear.py
diff --git a/tests/basics/tests/list_compare.py b/tests/basics/list_compare.py
similarity index 100%
rename from tests/basics/tests/list_compare.py
rename to tests/basics/list_compare.py
diff --git a/tests/basics/tests/list_copy.py b/tests/basics/list_copy.py
similarity index 100%
rename from tests/basics/tests/list_copy.py
rename to tests/basics/list_copy.py
diff --git a/tests/basics/tests/list_count.py b/tests/basics/list_count.py
similarity index 100%
rename from tests/basics/tests/list_count.py
rename to tests/basics/list_count.py
diff --git a/tests/basics/tests/list_index.py b/tests/basics/list_index.py
similarity index 100%
rename from tests/basics/tests/list_index.py
rename to tests/basics/list_index.py
diff --git a/tests/basics/tests/list_insert.py b/tests/basics/list_insert.py
similarity index 100%
rename from tests/basics/tests/list_insert.py
rename to tests/basics/list_insert.py
diff --git a/tests/basics/tests/list_mult.py b/tests/basics/list_mult.py
similarity index 100%
rename from tests/basics/tests/list_mult.py
rename to tests/basics/list_mult.py
diff --git a/tests/basics/tests/list_pop.py b/tests/basics/list_pop.py
similarity index 100%
rename from tests/basics/tests/list_pop.py
rename to tests/basics/list_pop.py
diff --git a/tests/basics/tests/list_remove.py b/tests/basics/list_remove.py
similarity index 100%
rename from tests/basics/tests/list_remove.py
rename to tests/basics/list_remove.py
diff --git a/tests/basics/tests/list_reverse.py b/tests/basics/list_reverse.py
similarity index 100%
rename from tests/basics/tests/list_reverse.py
rename to tests/basics/list_reverse.py
diff --git a/tests/basics/tests/list_sort.py b/tests/basics/list_sort.py
similarity index 100%
rename from tests/basics/tests/list_sort.py
rename to tests/basics/list_sort.py
diff --git a/tests/basics/tests/list_sum.py b/tests/basics/list_sum.py
similarity index 100%
rename from tests/basics/tests/list_sum.py
rename to tests/basics/list_sum.py
diff --git a/tests/basics/tests/map.py b/tests/basics/map.py
similarity index 100%
rename from tests/basics/tests/map.py
rename to tests/basics/map.py
diff --git a/tests/basics/tests/set1.py b/tests/basics/set1.py
similarity index 100%
rename from tests/basics/tests/set1.py
rename to tests/basics/set1.py
diff --git a/tests/basics/tests/set_add.py b/tests/basics/set_add.py
similarity index 100%
rename from tests/basics/tests/set_add.py
rename to tests/basics/set_add.py
diff --git a/tests/basics/tests/set_binop.py b/tests/basics/set_binop.py
similarity index 100%
rename from tests/basics/tests/set_binop.py
rename to tests/basics/set_binop.py
diff --git a/tests/basics/tests/set_clear.py b/tests/basics/set_clear.py
similarity index 100%
rename from tests/basics/tests/set_clear.py
rename to tests/basics/set_clear.py
diff --git a/tests/basics/tests/set_copy.py b/tests/basics/set_copy.py
similarity index 100%
rename from tests/basics/tests/set_copy.py
rename to tests/basics/set_copy.py
diff --git a/tests/basics/tests/set_difference.py b/tests/basics/set_difference.py
similarity index 100%
rename from tests/basics/tests/set_difference.py
rename to tests/basics/set_difference.py
diff --git a/tests/basics/tests/set_discard.py b/tests/basics/set_discard.py
similarity index 100%
rename from tests/basics/tests/set_discard.py
rename to tests/basics/set_discard.py
diff --git a/tests/basics/tests/set_intersection.py b/tests/basics/set_intersection.py
similarity index 100%
rename from tests/basics/tests/set_intersection.py
rename to tests/basics/set_intersection.py
diff --git a/tests/basics/tests/set_isdisjoint.py b/tests/basics/set_isdisjoint.py
similarity index 100%
rename from tests/basics/tests/set_isdisjoint.py
rename to tests/basics/set_isdisjoint.py
diff --git a/tests/basics/tests/set_isfooset.py b/tests/basics/set_isfooset.py
similarity index 100%
rename from tests/basics/tests/set_isfooset.py
rename to tests/basics/set_isfooset.py
diff --git a/tests/basics/tests/set_iter.py b/tests/basics/set_iter.py
similarity index 100%
rename from tests/basics/tests/set_iter.py
rename to tests/basics/set_iter.py
diff --git a/tests/basics/tests/set_pop.py b/tests/basics/set_pop.py
similarity index 100%
rename from tests/basics/tests/set_pop.py
rename to tests/basics/set_pop.py
diff --git a/tests/basics/tests/set_remove.py b/tests/basics/set_remove.py
similarity index 100%
rename from tests/basics/tests/set_remove.py
rename to tests/basics/set_remove.py
diff --git a/tests/basics/tests/set_symmetric_difference.py b/tests/basics/set_symmetric_difference.py
similarity index 100%
rename from tests/basics/tests/set_symmetric_difference.py
rename to tests/basics/set_symmetric_difference.py
diff --git a/tests/basics/tests/set_union.py b/tests/basics/set_union.py
similarity index 100%
rename from tests/basics/tests/set_union.py
rename to tests/basics/set_union.py
diff --git a/tests/basics/tests/set_update.py b/tests/basics/set_update.py
similarity index 100%
rename from tests/basics/tests/set_update.py
rename to tests/basics/set_update.py
diff --git a/tests/basics/tests/sorted.py b/tests/basics/sorted.py
similarity index 100%
rename from tests/basics/tests/sorted.py
rename to tests/basics/sorted.py
diff --git a/tests/basics/tests/string-format.py b/tests/basics/string-format.py
similarity index 100%
rename from tests/basics/tests/string-format.py
rename to tests/basics/string-format.py
diff --git a/tests/basics/tests/string-slice.py b/tests/basics/string-slice.py
similarity index 100%
rename from tests/basics/tests/string-slice.py
rename to tests/basics/string-slice.py
diff --git a/tests/basics/tests/string1.py b/tests/basics/string1.py
similarity index 100%
rename from tests/basics/tests/string1.py
rename to tests/basics/string1.py
diff --git a/tests/basics/tests/string_find.py b/tests/basics/string_find.py
similarity index 100%
rename from tests/basics/tests/string_find.py
rename to tests/basics/string_find.py
diff --git a/tests/basics/tests/true-value.py b/tests/basics/true-value.py
similarity index 100%
rename from tests/basics/tests/true-value.py
rename to tests/basics/true-value.py
diff --git a/tests/basics/tests/try1.py b/tests/basics/try1.py
similarity index 100%
rename from tests/basics/tests/try1.py
rename to tests/basics/try1.py
diff --git a/tests/basics/tests/try2.py b/tests/basics/try2.py
similarity index 100%
rename from tests/basics/tests/try2.py
rename to tests/basics/try2.py
diff --git a/tests/basics/tests/try3.py b/tests/basics/try3.py
similarity index 100%
rename from tests/basics/tests/try3.py
rename to tests/basics/try3.py
diff --git a/tests/basics/tests/try4.py b/tests/basics/try4.py
similarity index 100%
rename from tests/basics/tests/try4.py
rename to tests/basics/try4.py
diff --git a/tests/basics/tests/types1.py b/tests/basics/types1.py
similarity index 100%
rename from tests/basics/tests/types1.py
rename to tests/basics/types1.py
diff --git a/tests/basics/tests/while1.py b/tests/basics/while1.py
similarity index 100%
rename from tests/basics/tests/while1.py
rename to tests/basics/while1.py
diff --git a/tests/basics/tests/zip.py b/tests/basics/zip.py
similarity index 100%
rename from tests/basics/tests/zip.py
rename to tests/basics/zip.py
diff --git a/tests/io/data/file1 b/tests/io/data/file1
new file mode 100644
index 0000000000000000000000000000000000000000..e08206337f38528ff20d46ebff0826e72a12ff9d
--- /dev/null
+++ b/tests/io/data/file1
@@ -0,0 +1,3 @@
+longer line1
+line2
+line3
diff --git a/tests/io/file1.py b/tests/io/file1.py
new file mode 100644
index 0000000000000000000000000000000000000000..8552f535bd9b0e7de35fcf180ebbfbefcbddcac4
--- /dev/null
+++ b/tests/io/file1.py
@@ -0,0 +1,4 @@
+f = open("io/data/file1")
+print(f.read(5))
+print(f.readline())
+print(f.read())
diff --git a/tests/basics/run-tests b/tests/run-tests
similarity index 94%
rename from tests/basics/run-tests
rename to tests/run-tests
index bc2969ae3d4b9ee92d4473c404b76b685c57b356..318920b5eeac2bf387e6802ab8e5ce9b0e6811e5 100755
--- a/tests/basics/run-tests
+++ b/tests/run-tests
@@ -2,7 +2,7 @@
 
 RM="/bin/rm -f"
 CPYTHON3=python3.3
-MP_PY=../../unix/py
+MP_PY=../unix/py
 
 numtests=0
 numtestcases=0
@@ -10,7 +10,7 @@ numpassed=0
 numfailed=0
 namefailed=
 
-for infile in tests/*.py
+for infile in basics/*.py io/*.py
 do
     basename=`basename $infile .py`
     outfile=${basename}.out