def test_record_metrics_local(metric_name, metric_value): """ You can record metrics during your run. The number of times doesn't matter, we record all of them. """ assume(metric_name.strip() != '') assume(metric_name != None) try: with TrackingSession('test', 1, 'test', 'test', LocalState()) as session: session.record_metric(metric_name, metric_value) except AssertionError: print('error')
def test_record_settings_without_keys(): with TrackingSession('test', 1, 'test', 'test', LocalState()) as session: session.record_settings()
def test_session_scope_behavior(): with TrackingSession('test', 1, 'test', 'test', LocalState()) as run: pass
def test_record_output_with_non_existing_file(): with pytest.raises(AssertionError): with TrackingSession('test', 1, 'test', 'test', LocalState()) as session: session.record_output('test2.txt', 'test.txt')
def test_record_settings(): with TrackingSession('test', 1, 'test', 'test', LocalState()) as session: session.record_settings(test='value')
def test_record_output_with_empty_source_file(): with pytest.raises(AssertionError): with TrackingSession('test', 1, 'test', 'test', LocalState()) as session: session.record_output(None, 'test.txt')
def test_record_output_with_empty_filename(run_output): with pytest.raises(AssertionError): with TrackingSession('test', 1, 'test', 'test', LocalState()) as session: session.record_output(run_output, None)
def test_record_output(run_output): with TrackingSession('test', 1, 'test', 'test', LocalState()) as session: session.record_output(run_output, 'test.txt')
def test_record_metric_with_invalid_name_type(): with pytest.raises(AssertionError): with TrackingSession('test', 1, 'test', 'test', LocalState()) as session: session.record_metric(1.0, 'invalid')
def test_record_metric_without_value(): with pytest.raises(AssertionError): with TrackingSession('test', 1, 'test', 'test', LocalState()) as session: session.record_metric('test', None)