Skip to content

Commit

Permalink
Merged in pull requests that added unit testing and working docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
hover2pi committed Mar 24, 2016
2 parents 27a9f79 + f7c92d7 commit 1fcd65e
Show file tree
Hide file tree
Showing 10 changed files with 95 additions and 21 deletions.
20 changes: 20 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
language: python

python:
- '2.7'
- '3.3'
- '3.4'
- '3.5'

install:
- pip install astropy
- pip install matplotlib

script:
- py.test

matrix:
allow_failures:
- python: 3.3
- python: 3.4
- python: 3.5
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Installation

To install, just do:
To install:

```pip install astrodbkit```

Expand All @@ -19,7 +19,7 @@ db = astrodb.Database(dbpath)

## Need a database?

To use the BDNYC Database, download the latest data release from [the BDNYCdb repo on Github](https://github.com/BDNYC/BDNYCdb.git).
To use the BDNYC Database of brown dwarf data, download the latest data release from [the BDNYCdb repo on Github](https://github.com/BDNYC/BDNYCdb.git).

## Enjoy!

Expand Down
2 changes: 1 addition & 1 deletion astrodbkit/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from pkg_resources import get_distribution
__version__ = get_distribution('astrodbkit').version
__version__ = '0.3.0.post6'
28 changes: 13 additions & 15 deletions astrodbkit/astrodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,20 @@ def create_database(dbpath):
else: print("Please provide a path and file name with a .db file extension, e.g. /Users/<username>/Desktop/test.db")

class Database:
"""
Initialize the database.
Parameters
----------
dbpath: str
The path to the database file.
Returns
-------
object
The database object
"""
def __init__(self, dbpath):
"""
Initialize the database.
Parameters
----------
dbpath: str
The path to the database file.
Returns
-------
object
The database object
"""

if os.path.isfile(dbpath):

# Create connection
Expand Down
File renamed without changes.
54 changes: 54 additions & 0 deletions astrodbkit/tests/test_astrodb.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import pytest
import tempfile
import os
from astropy.utils.data import download_file
from .. import astrodb


def setup_module(module):
db_path = download_file("http://github.com/BDNYC/BDNYCdb/raw/master/BDNYCv1.0.db")
module.bdnyc_db = astrodb.Database(db_path)
filename = os.path.join(tempfile.mkdtemp(), 'empty_db.db')
module.empty_db = astrodb.create_database(filename)

def test_loaddb():
print(bdnyc_db)
print(empty_db)

def test_search():
bdnyc_db.search('1234','sources')

def test_inventory():
bdnyc_db.inventory(825)

def test_sqlquery():
bdnyc_db.query("SELECT s.id, s.ra, s.dec, s.shortname, p.source_id, p.band, p.magnitude "
"FROM sources as s JOIN photometry as p ON s.id=p.source_id "
"WHERE s.dec<=-10 AND p.band=='W1'")

def test_schema():
bdnyc_db.schema('sources')

@pytest.mark.xfail
def test_add_data():
assert False

@pytest.mark.xfail
def test_clean_up():
assert False

@pytest.mark.xfail
def test_merge():
assert False

@pytest.mark.xfail
def test_output_spectrum():
assert False

@pytest.mark.xfail
def test_plot_spectrum():
assert False

@pytest.mark.xfail
def test_table():
assert False
Empty file.
2 changes: 1 addition & 1 deletion docs/astrodb.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
astrodb module
==============

.. automodule:: astrodb
.. automodule:: astrodbkit.astrodb
:members:
:undoc-members:
:show-inheritance:
2 changes: 1 addition & 1 deletion docs/votools.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
votools module
================

.. automodule:: votools
.. automodule:: astrodbkit.votools
:members:
:undoc-members:
:show-inheritance:
4 changes: 3 additions & 1 deletion setup.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
from codecs import open
from os import path

from astrodbkit import __version__

setup(
name='astrodbkit',
version='0.3.0.post6',
version=__version__,
description='Astronomy database management using SQL and Python',
url='https://github.com/BDNYC/astrodbkit.git',
author='Joe Filippazzo',
Expand Down

0 comments on commit 1fcd65e

Please sign in to comment.