diff --git a/hy/importer.py b/hy/importer.py index e588f1d..a81d27b 100644 --- a/hy/importer.py +++ b/hy/importer.py @@ -1,5 +1,5 @@ # Copyright (c) 2013 Paul Tagliamonte -# Copyright (c) 2013 Bob Tolbert +# Copyright (c) 2013, 2014 Bob Tolbert # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), @@ -209,5 +209,5 @@ class MetaImporter(object): return MetaLoader(path) -sys.meta_path.append(MetaImporter()) +sys.meta_path.insert(0, MetaImporter()) sys.path.insert(0, "") diff --git a/tests/native_tests/core.hy b/tests/native_tests/core.hy index dcdb59b..2e92545 100644 --- a/tests/native_tests/core.hy +++ b/tests/native_tests/core.hy @@ -1,5 +1,5 @@ ;; Copyright (c) 2013 Paul Tagliamonte -;; Copyright (c) 2013 Bob Tolbert +;; Copyright (c) 2013, 2014 Bob Tolbert ;; Permission is hereby granted, free of charge, to any person obtaining a ;; copy of this software and associated documentation files (the "Software"), @@ -597,3 +597,8 @@ (assert (not (keyword? ":foo"))) (assert (not (keyword? 1))) (assert (not (keyword? nil)))) + +(defn test-import-init-hy [] + "NATIVE: testing import of __init__.hy" + (import tests.resources.bin) + (assert (in "_null_fn_for_import_test" (dir tests.resources.bin)))) diff --git a/tests/resources/bin/__init__.hy b/tests/resources/bin/__init__.hy index e69de29..ddb8095 100644 --- a/tests/resources/bin/__init__.hy +++ b/tests/resources/bin/__init__.hy @@ -0,0 +1,2 @@ +(defn -null-fn-for-import-test [] + pass)