Just disable the test if the dependency is not installed. The easiest
way to do that is to put the tests in their own file and set
disabled=True when it isn't installed (see how the
sympy/external/tests/test_numpy.py tests are written).

If there's a slower fallback when numpy is not installed, you can use
that. Otherwise, just raise NotImplementedError, or ImportError.

Aaron Meurer

On Tue, Jun 4, 2013 at 1:27 PM, Jason Moore <[email protected]> wrote:
> Ok. So for example, tests for a module in sympy/physics/mechanics should go
> in sympy/external/tests if it includes a dependency?
>
>
> Jason
> moorepants.info
> +01 530-601-9791
>
>
> On Tue, Jun 4, 2013 at 9:43 AM, Ondřej Čertík <[email protected]>
> wrote:
>>
>> On Tue, Jun 4, 2013 at 10:31 AM, Jason Moore <[email protected]> wrote:
>> > I'm curious what the general practice in SymPy is for external packages.
>> > I
>> > want to include some code that depends on an external package (e.g.
>> > NumPy).
>> > I see the sympy.external.import_module function and have found various
>> > uses
>> > of it. SymPy doesn't seem to require any dependencies but there are a
>> > lot of
>> > import_module calls in the source. Is it ok practice to just add what
>> > you
>> > want?
>>
>> The general idea is to always allow the sympy test suite to pass
>> without any dependencies.
>> And if you depend on numpy, test it in tests like
>> sympy/external/tests/test_numpy.py.
>>
>> As to the import_module, I don't know.
>>
>> Ondrej
>>
>> >
>> > Jason
>> > moorepants.info
>> > +01 530-601-9791
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "sympy" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> > an
>> > email to [email protected].
>> > To post to this group, send email to [email protected].
>> > Visit this group at http://groups.google.com/group/sympy?hl=en-US.
>> > For more options, visit https://groups.google.com/groups/opt_out.
>> >
>> >
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "sympy" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at http://groups.google.com/group/sympy?hl=en-US.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/sympy?hl=en-US.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to