from nose.plugins.attrib import attr
from test.integration.base import DBTIntegrationTest
import os


class TestAnalyses(DBTIntegrationTest):

    @property
    def schema(self):
        return "test_analyses_019"

    @property
    def models(self):
        return "test/integration/019_analysis_tests/models"

    def analysis_path(self):
        return "test/integration/019_analysis_tests/analysis"

    @property
    def project_config(self):
        return {
            "analysis-paths": [self.analysis_path()]
        }

    @attr(type='postgres')
    def test_working_macros(self):

        self.run_dbt(["compile"])

        self.assertEqual(['analysis.sql'], os.listdir('target/build-analysis/test'))

        models = self.get_models_in_schema()
        self.assertTrue('my_model' in models.keys())

@@ -566,21 +566,15 @@
 est_
-working_macro
+analyse
 s(se
@@ -606,17 +606,141 @@
 t(%5B%22
-compile%22%5D
+run%22%5D)%0A%0A        compiled_analysis_path = os.path.join(%0A            'target/build-analysis',%0A            self.analysis_path()%0A        
 )%0A%0A 
@@ -763,16 +763,29 @@
 rtEqual(
+%0A            
 %5B'analys
@@ -797,49 +797,64 @@
 l'%5D,
- os.listdir('target/build-analysis/test')
+%0A            os.listdir(compiled_analysis_path)%0A        
 )%0A%0A 

fix analysis tests